Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Custom SVG shapes uncaught exception(Custom SVG shapes)
Custom SVG shapes uncaught exception [message #1755487] Fri, 03 March 2017 17:22 Go to next message
Simos Gerasimou is currently offline Simos GerasimouFriend
Messages: 3
Registered: March 2017
Junior Member
Hi,

I am trying to create custom SVG shapes on a Papyrus profile following the video tutorial on Papyrus youtube channel (sorry but I can't send the link; no idea why).

I have associated an SVG shape with each stereotype in my profile. When I apply the profile to a new Papyrus model I get an error "Uncaught exception in transaction pre-commit task" caused by the org.eclipse.papyrus.infra.core plugin.

Here is the stack trace:

java.lang.NullPointerException
	at org.apache.batik.dom.svg.AbstractSVGLength$DefaultContext.getViewportWidth(Unknown Source)
	at org.apache.batik.parser.UnitProcessor.percentagesToPixels(Unknown Source)
	at org.apache.batik.parser.UnitProcessor.svgToUserSpace(Unknown Source)
	at org.apache.batik.dom.svg.AbstractSVGLength.getValue(Unknown Source)
	at org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SVGNodePlateFigure.getValueOf(SVGNodePlateFigure.java:197)
	at org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SVGNodePlateFigure.getSvgDimension(SVGNodePlateFigure.java:212)
	at org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SVGNodePlateFigure.setSVGDocument(SVGNodePlateFigure.java:160)
	at org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart.refreshSVGPath(NodeEditPart.java:107)
	at org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart.refreshVisuals(NodeEditPart.java:178)
	at org.eclipse.papyrus.uml.diagram.common.editparts.UMLNodeEditPart.refreshVisuals(UMLNodeEditPart.java:254)
	at org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart.refreshVisuals(NamedElementEditPart.java:118)
	at org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart.refreshVisuals(RoundedCompartmentEditPart.java:181)
	at org.eclipse.papyrus.uml.diagram.common.editparts.ClassifierEditPart.refreshVisuals(ClassifierEditPart.java:64)
	at org.eclipse.papyrus.uml.diagram.common.editparts.ClassEditPart.refreshVisuals(ClassEditPart.java:42)
	at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:725)
	at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:644)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.access$3(GraphicalEditPart.java:1)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart$3.run(GraphicalEditPart.java:861)
	at org.eclipse.papyrus.infra.emf.readonly.PapyrusROTransactionalEditingDomain.runExclusive(PapyrusROTransactionalEditingDomain.java:271)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.refresh(GraphicalEditPart.java:851)
	at org.eclipse.papyrus.uml.diagram.common.editparts.UMLNodeEditPart.refresh(UMLNodeEditPart.java:99)
	at org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart.refresh(NamedElementEditPart.java:108)
	at org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper.refresh(DiagramHelper.java:87)
	at org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper.refresh(DiagramHelper.java:116)
	at org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper$2.run(DiagramHelper.java:181)
	at org.eclipse.papyrus.infra.core.utils.TransactionPrecommitExecutor$1.doExecute(TransactionPrecommitExecutor.java:133)
	at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
	at org.eclipse.emf.transaction.util.TriggerCommand.execute(TriggerCommand.java:113)
	at org.eclipse.papyrus.infra.emf.gmf.command.NotifyingWorkspaceCommandStack.executeTriggers(NotifyingWorkspaceCommandStack.java:418)
	at org.eclipse.papyrus.infra.core.utils.TransactionPrecommitExecutor.transactionClosing(TransactionPrecommitExecutor.java:164)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl$LifecycleImpl.fireLifecycleEvent(TransactionalEditingDomainImpl.java:1380)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl$LifecycleImpl.transactionClosing(TransactionalEditingDomainImpl.java:1406)
	at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:398)
	at org.eclipse.papyrus.infra.emf.readonly.PapyrusROTransactionalEditingDomain.runExclusive(PapyrusROTransactionalEditingDomain.java:276)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.postcommit(TransactionalEditingDomainImpl.java:771)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.deactivate(TransactionalEditingDomainImpl.java:543)
	at org.eclipse.emf.transaction.impl.TransactionImpl.close(TransactionImpl.java:712)
	at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:474)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:155)
	at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:488)
	at org.eclipse.papyrus.infra.emf.gmf.command.CheckedOperationHistory.doExecute(CheckedOperationHistory.java:206)
	at org.eclipse.papyrus.infra.emf.gmf.command.CheckedOperationHistory.execute(CheckedOperationHistory.java:195)
	at org.eclipse.papyrus.infra.emf.gmf.command.NotifyingWorkspaceCommandStack.doExecute(NotifyingWorkspaceCommandStack.java:264)
	at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
	at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
	at org.eclipse.papyrus.infra.emf.gmf.command.NestingNotifyingWorkspaceCommandStack.execute(NestingNotifyingWorkspaceCommandStack.java:130)
	at org.eclipse.papyrus.uml.properties.profile.ui.compositesformodel.AppliedStereotypeCompositeOnModel$1$1.run(AppliedStereotypeCompositeOnModel.java:482)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4024)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3700)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:687)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:604)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	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:497)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1519)


Any thoughts why this is happening? Am I missing something or is it a Papyrus bug?


Thanks,
Simos

Re: Custom SVG shapes uncaught exception [message #1755726 is a reply to message #1755487] Tue, 07 March 2017 09:08 Go to previous messageGo to next message
Benoit Maggi is currently offline Benoit MaggiFriend
Messages: 129
Registered: March 2013
Location: Bordeaux, France
Senior Member
Hi Simos,

Can you share the problematic svg?

I looked in the code and papyrus is calling the SVGLength.getValue()
The NPE seems to come from the batik library, which probably can't correctly parse your svg.

You may try 2 things:
- use a more recent version of batik (hopping they fixed that)
- fix your svg (something seems wrong in the lenght value)

Regards,
BenoƮt
Re: Custom SVG shapes uncaught exception [message #1755762 is a reply to message #1755487] Tue, 07 March 2017 16:33 Go to previous messageGo to next message
Bernd Busam is currently offline Bernd BusamFriend
Messages: 10
Registered: February 2017
Location: Hamburg, Germany
Junior Member
Hi guys,

it seems I'm facing a similar issue. I tried to reference the SVG via Profile (UML>icon>kind=shape & location=platform: \resource\...) as well as by CSS reference (svgFile:"platform:/resource/..). Both shows the subsequent phenomena:

- the SVG first shows up after moving the UML element or a refresh of the entire diagram
- each refresh of the diagram throws the error below (independant if it shows the shape correctly or not)
- I've created different SVG with differnt tools (Visio, inkscape, MS Picuture Manager)
- depending on the SVG some are rendered correctly some are destroyed

So I don't think the SVG itself is the issue - but you never know. I've attached two SVG for testing.

Is there any workarround to show a shape graphic? I would be happy with a fixed size. I tried PNG & JPG via UML profile property. I can see the graphic in the small preview but it does not show up when I use it in the model. Is there maybe a CSS command to make it visible?

I was able to make it work for icons referenced via UML profile property (UML>icon>kind=icon & location=platform: \resource\...). The 16/16px PNG are properly shown in the model tree. With CSS command "displayIcon:true;" it also shows up in the name compartment.

Regards
Bernd
----------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_111
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Command-line arguments: -os win32 -ws win32 -arch x86_64

org.eclipse.ui
Error
Tue Mar 07 16:38:21 CET 2017
Unhandled event loop exception

org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:65)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:282)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:264)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:494)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:488)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:286)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:507)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:558)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:378)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:324)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:86)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1270)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1078)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1103)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1088)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1130)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1126)
at org.eclipse.swt.widgets.Widget.wmKeyDown(Widget.java:1849)
at org.eclipse.swt.widgets.Control.WM_KEYDOWN(Control.java:5172)
at org.eclipse.swt.widgets.Canvas.WM_KEYDOWN(Canvas.java:454)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4831)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:359)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5110)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2552)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3822)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
Caused by: java.lang.NullPointerException
at org.apache.batik.dom.svg.AbstractSVGLength$DefaultContext.getPixelUnitToMillimeter(Unknown Source)
at org.apache.batik.parser.UnitProcessor.svgToUserSpace(Unknown Source)
at org.apache.batik.dom.svg.AbstractSVGLength.getValue(Unknown Source)
at org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SVGNodePlateFigure.getValueOf(SVGNodePlateFigure.java:197)
at org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SVGNodePlateFigure.getSvgDimension(SVGNodePlateFigure.java:212)
at org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SVGNodePlateFigure.setSVGDocument(SVGNodePlateFigure.java:160)
at org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart.refreshSVGPath(NodeEditPart.java:107)
at org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart.refreshVisuals(NodeEditPart.java:178)
at org.eclipse.papyrus.uml.diagram.common.editparts.UMLNodeEditPart.refreshVisuals(UMLNodeEditPart.java:254)
at org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart.refreshVisuals(NamedElementEditPart.java:118)
at org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart.refreshVisuals(RoundedCompartmentEditPart.java:181)
at org.eclipse.papyrus.uml.diagram.common.editparts.ClassifierEditPart.refreshVisuals(ClassifierEditPart.java:64)
at org.eclipse.papyrus.uml.diagram.common.editparts.ClassEditPart.refreshVisuals(ClassEditPart.java:42)
at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:725)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:644)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.access$3(GraphicalEditPart.java:1)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart$3.run(GraphicalEditPart.java:861)
at org.eclipse.papyrus.infra.emf.readonly.PapyrusROTransactionalEditingDomain.runExclusive(PapyrusROTransactionalEditingDomain.java:271)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.refresh(GraphicalEditPart.java:851)
at org.eclipse.papyrus.uml.diagram.common.editparts.UMLNodeEditPart.refresh(UMLNodeEditPart.java:99)
at org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart.refresh(NamedElementEditPart.java:108)
at org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper.refresh(DiagramHelper.java:87)
at org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper.refresh(DiagramHelper.java:116)
at org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper.refresh(DiagramHelper.java:154)
at org.eclipse.papyrus.infra.gmfdiag.common.handler.RefreshHandler.execute(RefreshHandler.java:84)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:295)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
... 50 more

Re: Custom SVG shapes uncaught exception [message #1755808 is a reply to message #1755487] Wed, 08 March 2017 11:00 Go to previous messageGo to next message
Bernd Busam is currently offline Bernd BusamFriend
Messages: 10
Registered: February 2017
Location: Hamburg, Germany
Junior Member
Hi all,

I'm facing a quite similar problem. Basically my Papyrus 2.02 is able to render SVG specified within my SysML profile for shapes. Unfortunately each rendering action of stereotype application within my model throws exeptions (see below). It does make no difference a if I reference the SVG via:

a) Stereotype properties > Icon > Add
Kind=Shape
Location=platform:/resource/..

b) CSS
[appliedStereotypes~="MyStereotype"]{
svgFile:"platform:/resource/..";
}

I'm not convinced, that a corrupted SVG is the root cause. To verfy this if tried SVG creation with Visio, MS Picture Manager & Inkscape. Attached you find 3 files.

I also tried to use non-resizeable formats (PNG, JPG) for the shapes instead - as I did for the icons. This formats are not rendered in my model at all. I would be happy with that solution until the SVG issue is solved. Do I need a special CSS command to make pixel formats visible on shapes?

Bernd

eclipse.buildId=unknown
java.version=1.8.0_111
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Command-line arguments:  -os win32 -ws win32 -arch x86_64

org.eclipse.ui
Error
Wed Mar 08 11:05:24 CET 2017
Unhandled event loop exception

org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException)
	at org.eclipse.swt.SWT.error(SWT.java:4533)
	at org.eclipse.swt.SWT.error(SWT.java:4448)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4211)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3827)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
Caused by: java.lang.NullPointerException
	at org.apache.batik.dom.svg.AbstractSVGLength$DefaultContext.getPixelUnitToMillimeter(Unknown Source)
	at org.apache.batik.parser.UnitProcessor.svgToUserSpace(Unknown Source)
	at org.apache.batik.dom.svg.AbstractSVGLength.getValue(Unknown Source)
	at org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SVGNodePlateFigure.getValueOf(SVGNodePlateFigure.java:197)
	at org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SVGNodePlateFigure.getSvgDimension(SVGNodePlateFigure.java:212)
	at org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SVGNodePlateFigure.setSVGDocument(SVGNodePlateFigure.java:160)
	at org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart.refreshSVGPath(NodeEditPart.java:107)
	at org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart.refreshVisuals(NodeEditPart.java:178)
	at org.eclipse.papyrus.uml.diagram.common.editparts.UMLNodeEditPart.refreshVisuals(UMLNodeEditPart.java:254)
	at org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart.refreshVisuals(NamedElementEditPart.java:118)
	at org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart.refreshVisuals(RoundedCompartmentEditPart.java:181)
	at org.eclipse.papyrus.uml.diagram.common.editparts.ClassifierEditPart.refreshVisuals(ClassifierEditPart.java:64)
	at org.eclipse.papyrus.uml.diagram.common.editparts.ClassEditPart.refreshVisuals(ClassEditPart.java:42)
	at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:725)
	at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:644)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.access$3(GraphicalEditPart.java:1)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart$3.run(GraphicalEditPart.java:861)
	at org.eclipse.papyrus.infra.emf.readonly.PapyrusROTransactionalEditingDomain.runExclusive(PapyrusROTransactionalEditingDomain.java:271)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.refresh(GraphicalEditPart.java:851)
	at org.eclipse.papyrus.uml.diagram.common.editparts.UMLNodeEditPart.refresh(UMLNodeEditPart.java:99)
	at org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart.refresh(NamedElementEditPart.java:108)
	at org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper.refresh(DiagramHelper.java:87)
	at org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper.refresh(DiagramHelper.java:116)
	at org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper.refresh(DiagramHelper.java:154)
	at org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper.refreshDiagrams(DiagramHelper.java:233)
	at org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper$3.run(DiagramHelper.java:270)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
	... 23 more

Re: Custom SVG shapes uncaught exception [message #1755853 is a reply to message #1755808] Wed, 08 March 2017 16:01 Go to previous messageGo to next message
Thanos Zolotas is currently offline Thanos ZolotasFriend
Messages: 51
Registered: November 2016
Location: York
Member
Hi,

I face a similar problem. I created my SVGs using Inkscape. I attach 6 symbols in the GSN_Shapes.rar. What I identified with these symbols in *my custom diagram* is that the exception is thrown when the 2nd shape is added. For the first it works fine (no matter which symbol I will pick).

I also attach the shape Simos Gerasimou refers to in his original post, named ring.svg
  • Attachment: GSN_Shapes.rar
    (Size: 5.61KB, Downloaded 58 times)
  • Attachment: ring.svg
    (Size: 19.49KB, Downloaded 140 times)

[Updated on: Wed, 08 March 2017 16:08]

Report message to a moderator

Re: Custom SVG shapes uncaught exception [message #1755857 is a reply to message #1755853] Wed, 08 March 2017 16:46 Go to previous messageGo to next message
Bernd Busam is currently offline Bernd BusamFriend
Messages: 10
Registered: February 2017
Location: Hamburg, Germany
Junior Member
Hi,

I gave the ring.svg a quick try. It does not throw any exception. Ok, we are coming closer. Anyone an idea how to create "propper" SVG?

Bernd
Re: Custom SVG shapes uncaught exception [message #1755909 is a reply to message #1755857] Thu, 09 March 2017 09:38 Go to previous messageGo to next message
Thanos Zolotas is currently offline Thanos ZolotasFriend
Messages: 51
Registered: November 2016
Location: York
Member
I believe it's definitely the SVG files that are wrong because in my implementation if I use SVG files that I borrowed from another project (Archimate for Papyrus [1]) then I got no exception without changing anything else. It would be good to have a justificiation on why some SVGs fail and some do not.

[1]: https://github.com/Adocus/ArchiMate-for-Papyrus

[Updated on: Thu, 09 March 2017 09:39]

Report message to a moderator

Re: Custom SVG shapes uncaught exception [message #1755919 is a reply to message #1755909] Thu, 09 March 2017 10:04 Go to previous messageGo to next message
Bernd Busam is currently offline Bernd BusamFriend
Messages: 10
Registered: February 2017
Location: Hamburg, Germany
Junior Member
I totally agree. We need to know how to generate clean SVG. And I would be very grateful to not do this by coding them.

Until that stage, does anyone can explain how to work with pixel formats in between?

Bernd
Re: Custom SVG shapes uncaught exception [message #1756033 is a reply to message #1755919] Fri, 10 March 2017 09:51 Go to previous messageGo to next message
Patrick Tessier is currently offline Patrick TessierFriend
Messages: 238
Registered: July 2009
Location: Paris Saclay, France
Senior Member
To generate a clean SVG use Inkscape. this tool has gott a menu in order to clean SVG file.

Re: Custom SVG shapes uncaught exception [message #1756060 is a reply to message #1756033] Fri, 10 March 2017 12:56 Go to previous messageGo to next message
Bernd Busam is currently offline Bernd BusamFriend
Messages: 10
Registered: February 2017
Location: Hamburg, Germany
Junior Member
Hi Patrick,
this isn't working for me. I'm using in Inkscape 0.92. I gave it a try for a circle & a square. After creation of the form I used the option File>Clean Document. Still errors with that graphics Sad
  • Attachment: square.svg
    (Size: 1.80KB, Downloaded 120 times)
  • Attachment: circle.svg
    (Size: 1.77KB, Downloaded 131 times)
Re: Custom SVG shapes uncaught exception [message #1756160 is a reply to message #1756060] Mon, 13 March 2017 09:45 Go to previous messageGo to next message
Patrick Tessier is currently offline Patrick TessierFriend
Messages: 238
Registered: July 2009
Location: Paris Saclay, France
Senior Member
I will try to take time to see that. I hope for this week.
Re: Custom SVG shapes uncaught exception [message #1756164 is a reply to message #1756160] Mon, 13 March 2017 10:15 Go to previous messageGo to next message
Thanos Zolotas is currently offline Thanos ZolotasFriend
Messages: 51
Registered: November 2016
Location: York
Member
I've also tried saving the SVGs as Plain SVGs in Inkscape but the problem still exists.
Re: Custom SVG shapes uncaught exception [message #1756260 is a reply to message #1756164] Tue, 14 March 2017 15:53 Go to previous message
Thanos Zolotas is currently offline Thanos ZolotasFriend
Messages: 51
Registered: November 2016
Location: York
Member
I think that I have found the solution. When one creates a SVG (using Inkscape at least) inskcape adds the following regarding its width and height:

 width="430.28571mm"
height="258.85715mm"


The "mm" refers to the units that the size is calculated (millimeters in this example). It can also be pt, cm, px and many more. When you set the size in px (pixels) then Papyrus stops complaining (at least in my implementation).

What did I do to "fix" my shapes:
1) Open the SVG shape using Inkscape
2) Open the Document Properties window (either File->Document Properties or Ctr+Shift+D in Windows).
3) Select px in the units (see screenshot below)
4) Click the button "Resize page to drawing or selection"

http://i67.tinypic.com/2agvits.png

This will resize your canvas to the size of the SVG (as you have most probably been doing previously) but this time the measurement unit will be set to px. If you save your SVG and open it as SVG file you will notice that the width and height are now expressed as floats without any string value to denote the measurement unit. Hopefully, this will fix your shapes as it did for me. Please let me know.
Previous Topic:order of the ends of a binary association
Next Topic:[CSS] Adding sourceDecoration to a Connector?
Goto Forum:
  


Current Time: Sat Jan 25 13:33:53 GMT 2020

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

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

Back to the top