Skip to main content



      Home
Home » Modeling » Graphiti » SVG export fails with NPE
SVG export fails with NPE [message #1828149] Tue, 02 June 2020 12:22 Go to next message
Eclipse UserFriend
Hi,

I can export from my diagram editor in any other format. But for SVG it fails with an InvocationTargetException (triggered by an NPE in Apache Batik).

In Stack Overflow a problem was reported that sounds similar (and has a similar stack trace):
https://stackoverflow.com/questions/16138850/batik-svggraphics2d-nullpointerexception-when-drawing-image

They say that this is due to a missing batik-codec.jar on the classpath.

This may also be related to https://www.eclipse.org/forums/index.php/m/1809164/?srch=svg#msg_1809164
Re: SVG export fails with NPE [message #1828150 is a reply to message #1828149] Tue, 02 June 2020 12:24 Go to previous messageGo to next message
Eclipse UserFriend
here is the stack trace

java.lang.reflect.InvocationTargetException
at org.eclipse.graphiti.ui.features.DefaultSaveImageFeature$1.run(DefaultSaveImageFeature.java:281)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:436)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:352)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:469)
at org.eclipse.graphiti.ui.features.DefaultSaveImageFeature.save(DefaultSaveImageFeature.java:114)
at org.eclipse.graphiti.features.impl.AbstractSaveImageFeature.execute(AbstractSaveImageFeature.java:100)
at org.eclipse.graphiti.internal.command.GenericFeatureCommandWithContext.execute(GenericFeatureCommandWithContext.java:58)
at org.eclipse.graphiti.ui.internal.command.GefCommandWrapper.execute(GefCommandWrapper.java:48)
at org.eclipse.graphiti.ui.internal.editor.EmfOnGefCommand.execute(EmfOnGefCommand.java:51)
at org.eclipse.graphiti.internal.command.GFPreparableCommand2.doExecute(GFPreparableCommand2.java:40)
at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
at org.eclipse.emf.workspace.EMFCommandOperation.doExecute(EMFCommandOperation.java:119)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:496)
at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
at org.eclipse.graphiti.ui.internal.editor.GFWorkspaceCommandStackImpl.execute(GFWorkspaceCommandStackImpl.java:94)
at org.eclipse.graphiti.ui.internal.editor.GFCommandStack.execute(GFCommandStack.java:136)
at org.eclipse.graphiti.ui.internal.action.SaveImageAction.executeOnCommandStack(SaveImageAction.java:106)
at org.eclipse.graphiti.ui.internal.action.SaveImageAction.run(SaveImageAction.java:89)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:474)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:579)
at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:413)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4175)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3988)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3587)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1049)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:660)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:559)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: java.lang.NullPointerException
at org.apache.batik.svggen.ImageHandlerBase64Encoder.encodeImage(ImageHandlerBase64Encoder.java:157)
at org.apache.batik.svggen.ImageHandlerBase64Encoder.handleHREF(ImageHandlerBase64Encoder.java:133)
at org.apache.batik.svggen.ImageHandlerBase64Encoder.handleHREF(ImageHandlerBase64Encoder.java:72)
at org.apache.batik.svggen.DefaultImageHandler.handleImage(DefaultImageHandler.java:63)
at org.apache.batik.svggen.SimpleImageHandler.handleImage(SimpleImageHandler.java:100)
at org.apache.batik.svggen.SVGGraphics2D.drawImage(SVGGraphics2D.java:677)
at org.apache.batik.svggen.SVGGraphics2D.drawImage(SVGGraphics2D.java:868)
at org.eclipse.graphiti.export.batik.GraphicsToGraphics2DAdaptor.drawString(GraphicsToGraphics2DAdaptor.java:764)
at org.eclipse.graphiti.export.batik.GraphicsToGraphics2DAdaptor.drawText(GraphicsToGraphics2DAdaptor.java:719)
at org.eclipse.draw2d.Graphics.drawText(Graphics.java:426)
at org.eclipse.draw2d.Label.paintFigure(Label.java:515)
at org.eclipse.graphiti.ui.internal.figures.GFText.paintFigure(GFText.java:149)
at org.eclipse.draw2d.Figure.paint(Figure.java:1118)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1170)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1205)
at org.eclipse.draw2d.Figure.paint(Figure.java:1120)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1170)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1205)
at org.eclipse.draw2d.Figure.paint(Figure.java:1120)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1170)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1209)
at org.eclipse.draw2d.Figure.paint(Figure.java:1120)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1170)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1205)
at org.eclipse.draw2d.Figure.paint(Figure.java:1120)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1170)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1205)
at org.eclipse.draw2d.Figure.paint(Figure.java:1120)
at org.eclipse.graphiti.export.batik.SVGExporter.export(SVGExporter.java:50)
at org.eclipse.graphiti.ui.features.DefaultSaveImageFeature$1.run(DefaultSaveImageFeature.java:278)
... 49 more
Root exception:
java.lang.NullPointerException
at org.apache.batik.svggen.ImageHandlerBase64Encoder.encodeImage(ImageHandlerBase64Encoder.java:157)
at org.apache.batik.svggen.ImageHandlerBase64Encoder.handleHREF(ImageHandlerBase64Encoder.java:133)
at org.apache.batik.svggen.ImageHandlerBase64Encoder.handleHREF(ImageHandlerBase64Encoder.java:72)
at org.apache.batik.svggen.DefaultImageHandler.handleImage(DefaultImageHandler.java:63)
at org.apache.batik.svggen.SimpleImageHandler.handleImage(SimpleImageHandler.java:100)
at org.apache.batik.svggen.SVGGraphics2D.drawImage(SVGGraphics2D.java:677)
at org.apache.batik.svggen.SVGGraphics2D.drawImage(SVGGraphics2D.java:868)
at org.eclipse.graphiti.export.batik.GraphicsToGraphics2DAdaptor.drawString(GraphicsToGraphics2DAdaptor.java:764)
at org.eclipse.graphiti.export.batik.GraphicsToGraphics2DAdaptor.drawText(GraphicsToGraphics2DAdaptor.java:719)
at org.eclipse.draw2d.Graphics.drawText(Graphics.java:426)
at org.eclipse.draw2d.Label.paintFigure(Label.java:515)
at org.eclipse.graphiti.ui.internal.figures.GFText.paintFigure(GFText.java:149)
at org.eclipse.draw2d.Figure.paint(Figure.java:1118)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1170)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1205)
at org.eclipse.draw2d.Figure.paint(Figure.java:1120)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1170)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1205)
at org.eclipse.draw2d.Figure.paint(Figure.java:1120)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1170)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1209)
at org.eclipse.draw2d.Figure.paint(Figure.java:1120)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1170)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1205)
at org.eclipse.draw2d.Figure.paint(Figure.java:1120)
at org.eclipse.draw2d.Figure.paintChildren(Figure.java:1170)
at org.eclipse.draw2d.Figure.paintClientArea(Figure.java:1205)
at org.eclipse.draw2d.Figure.paint(Figure.java:1120)
at org.eclipse.graphiti.export.batik.SVGExporter.export(SVGExporter.java:50)
at org.eclipse.graphiti.ui.features.DefaultSaveImageFeature$1.run(DefaultSaveImageFeature.java:278)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:436)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:352)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:469)
at org.eclipse.graphiti.ui.features.DefaultSaveImageFeature.save(DefaultSaveImageFeature.java:114)
at org.eclipse.graphiti.features.impl.AbstractSaveImageFeature.execute(AbstractSaveImageFeature.java:100)
at org.eclipse.graphiti.internal.command.GenericFeatureCommandWithContext.execute(GenericFeatureCommandWithContext.java:58)
at org.eclipse.graphiti.ui.internal.command.GefCommandWrapper.execute(GefCommandWrapper.java:48)
at org.eclipse.graphiti.ui.internal.editor.EmfOnGefCommand.execute(EmfOnGefCommand.java:51)
at org.eclipse.graphiti.internal.command.GFPreparableCommand2.doExecute(GFPreparableCommand2.java:40)
at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
at org.eclipse.emf.workspace.EMFCommandOperation.doExecute(EMFCommandOperation.java:119)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:496)
at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
at org.eclipse.graphiti.ui.internal.editor.GFWorkspaceCommandStackImpl.execute(GFWorkspaceCommandStackImpl.java:94)
at org.eclipse.graphiti.ui.internal.editor.GFCommandStack.execute(GFCommandStack.java:136)
at org.eclipse.graphiti.ui.internal.action.SaveImageAction.executeOnCommandStack(SaveImageAction.java:106)
at org.eclipse.graphiti.ui.internal.action.SaveImageAction.run(SaveImageAction.java:89)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:474)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:579)
at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:413)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4175)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3988)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3587)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1049)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:660)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:559)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Re: SVG export fails with NPE [message #1828178 is a reply to message #1828150] Wed, 03 June 2020 06:14 Go to previous messageGo to next message
Eclipse UserFriend
Hi Hendrik,

I just checked that with the installations I have on my machine, but there SVG export is working. I searched a bit and found that in my installations there is another plugin (org.apache.commons.codec) that provides the Base64 encoder required here.

Do you have a special setup for your Eclipse? I haven't tested all distributions, but I guess most will provide above Apache plugin.

Michael
Re: SVG export fails with NPE [message #1828721 is a reply to message #1828178] Wed, 17 June 2020 11:00 Go to previous message
Eclipse UserFriend
Hi Michael,

my installation is based on the IDE for Eclipse Committers and also contains org.apache.commons.codec. But this is not the same as what is contained in batik-codec.jar (they have different contents).
I just confirmed though, that the batik codec is also present in my installation.

I will try some debugging to see what happens.

Henrik
Previous Topic:Problem with graphiti 0.11.4 dependency
Next Topic:Advice on ELK+Graphiti for incremental/dynamic views
Goto Forum:
  


Current Time: Tue Apr 29 22:12:47 EDT 2025

Powered by FUDForum. Page generated in 0.04536 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top