SVG 1.2 support causes exception?

2

I have a really simple SVG 'logo' created using Inkscape, exported as plain SVG. This consists of a single ellipse, filled by a colour gradient and some text to its right.

In JasperStudio in eclipse I place the image into the title band and then preview the report when the following exception occurs:

 

java.lang.ClassCastException: org.apache.batik.bridge.BridgeContext cannot be cast to org.apache.batik.bridge.svg12.SVG12BridgeContext
at org.apache.batik.bridge.svg12.SVG12TextElementBridge.addTextEventListeners(SVG12TextElementBridge.java:67)
at org.apache.batik.bridge.SVGTextElementBridge.initializeDynamicSupport(SVGTextElementBridge.java:399)
at org.apache.batik.bridge.SVGTextElementBridge.buildGraphicsNode(SVGTextElementBridge.java:308)
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:224)
at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:219)
at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:82)
at net.sf.jasperreports.renderers.BatikRenderer.ensureSvg(BatikRenderer.java:224)
at net.sf.jasperreports.renderers.BatikRenderer.ensureSvg(BatikRenderer.java:239)
at net.sf.jasperreports.renderers.BatikRenderer.getDimension(BatikRenderer.java:157)
at net.sf.jasperreports.engine.export.draw.ImageDrawer.draw(ImageDrawer.java:130)
at net.sf.jasperreports.engine.export.draw.PrintDrawVisitor.visit(PrintDrawVisitor.java:134)
at net.sf.jasperreports.engine.export.draw.PrintDrawVisitor.visit(PrintDrawVisitor.java:57)
at net.sf.jasperreports.engine.fill.JRTemplatePrintImage.accept(JRTemplatePrintImage.java:442)
at net.sf.jasperreports.engine.export.draw.FrameDrawer.draw(FrameDrawer.java:251)
at net.sf.jasperreports.engine.export.draw.FrameDrawer.draw(FrameDrawer.java:199)
at net.sf.jasperreports.engine.export.JRGraphics2DExporter.exportPage(JRGraphics2DExporter.java:273)
at net.sf.jasperreports.engine.export.JRGraphics2DExporter.exportReportToGraphics2D(JRGraphics2DExporter.java:246)
at net.sf.jasperreports.engine.export.JRGraphics2DExporter.exportReport(JRGraphics2DExporter.java:184)
at com.jaspersoft.studio.editor.preview.view.report.swt.ViewerCanvas.renderPage(ViewerCanvas.java:371)
at com.jaspersoft.studio.editor.preview.view.report.swt.ViewerCanvas.refresh(ViewerCanvas.java:344)
at com.jaspersoft.studio.editor.preview.view.report.swt.ViewerCanvas$2.viewerStateChanged(ViewerCanvas.java:122)
at com.jaspersoft.studio.editor.preview.view.report.swt.ReportViewer.fireViewerModelChanged(ReportViewer.java:340)
at com.jaspersoft.studio.editor.preview.view.report.swt.ReportViewer.setDocument(ReportViewer.java:88)
at com.jaspersoft.studio.editor.preview.view.report.swt.SWTViewer.setJRPRint(SWTViewer.java:113)
at com.jaspersoft.studio.editor.preview.PreviewJRPrint.switchRightView(PreviewJRPrint.java:234)
at com.jaspersoft.studio.editor.preview.PreviewContainer.switchRightView(PreviewContainer.java:238)
at com.jaspersoft.studio.editor.preview.PreviewJRPrint$3.switchView(PreviewJRPrint.java:202)
at com.jaspersoft.studio.editor.preview.PreviewJRPrint$1.run(PreviewJRPrint.java:161)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4491)
at com.jaspersoft.studio.editor.preview.PreviewJRPrint.setJasperPrint(PreviewJRPrint.java:156)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler$6.run(ReportControler.java:538)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3717)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3366)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
 
The use of SVG to obtain a suitable image render quality in both HTML, PDF and ODT outputs is important.
 
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Any ideas? 
 

Cheers

Barry

Attachments: 
barry-cw's picture
Joined: Dec 18 2013 - 4:43pm
Last seen: 5 years 10 months ago

This appears to relate purely to the prescence of the text element as indicated in the exception.

An SVG without text works.

barry-cw - 5 years 11 months ago

2 Answers:

0

Hi,
I tried with one of your SVG file and I got the error. Removing the textElement from the svg sources solved the error. 
I think you should an issue on the JR tracker. I'm not sure that there is something we can do on JSS side.

Best regards,
Massimo.

mrabbi's picture
8380
Joined: Oct 31 2011 - 9:20am
Last seen: 1 week 3 days ago
2

Hi,

 

I'm afraid there is little we can do about this as we fully rely on Batik to render the SVG for us. We are using the latest Batik available (1.7), so there is nothing to upgrade to at this moment.

Also, the problem seems to be related to SVG 1.2 specs, which I think failed to become standard as explained here:

http://en.wikipedia.org/wiki/Svg#Development_history

So I guess the only solution is to try alter the SVG using your editing tool and produce a Batik acceptable format.

 

Thanks,

Teodor

 

teodord's picture
4469
Joined: Jun 30 2006 - 9:00am
Last seen: 2 hours 58 min ago
Feedback
randomness