Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BPMN 2.0 Modeler » NullPointerException when saving model with custom attribute
NullPointerException when saving model with custom attribute [message #1385843] Wed, 11 June 2014 15:22 Go to next message
Cédric Casenove is currently offline Cédric CasenoveFriend
Messages: 22
Registered: December 2013
Junior Member
Hi Bob,

I try to use a model extension to add a custom property on a ServiceTask like this:

<modelExtension
        id="my.modelExtension.ServiceTask"
        name="Service Task Extensions"
        runtimeId="my.runtime"
        type="ServiceTask">
     <property
           name="customProp"
           type="EString"
           value="DefaultValue">
     </property>
</modelExtension>


I also defined a property tab for my ServiceTask to edit my custom property:

<propertyTab
         id="my.servicetask.tab"
          class="default"
          replaceTab="org.eclipse.bpmn2.modeler.serviceTask.tab"
          label="Configuration"
          runtimeId="my.runtime"
          type="org.eclipse.bpmn2.ServiceTask"
          features="customProp">
</propertyTab>


If I save the BPMN file, the custom property appears as expected in the xml:

<bpmn2:serviceTask id="AutoTask_1" ext:customProp="DefaultValue" .../>


If I remove the value in the text editor of my custom property and then save the BPMN file again, the custom property is removed from the xml, perfect.

But if I close the BPMN editor, re-open it and save the BPMN again, this time I get a NullPointerException:

java.lang.NullPointerException
	at org.eclipse.emf.ecore.xmi.impl.StringSegment.getLength(StringSegment.java:296)
	at org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerResourceImpl$Bpmn2ModelerXMLSave$Bpmn2ModelerXMLString.addLine(Bpmn2ModelerResourceImpl.java:670)
	at org.eclipse.emf.ecore.xmi.impl.XMLString.endEmptyElement(XMLString.java:415)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.endSaveFeatures(XMLSaveImpl.java:1632)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1483)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
	at org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerResourceImpl$Bpmn2ModelerXMLSave.saveElement(Bpmn2ModelerResourceImpl.java:920)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany(XMLSaveImpl.java:2412)
	at org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerResourceImpl$Bpmn2ModelerXMLSave.saveContainedMany(Bpmn2ModelerResourceImpl.java:867)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1548)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
	at org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerResourceImpl$Bpmn2ModelerXMLSave.saveElement(Bpmn2ModelerResourceImpl.java:920)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany(XMLSaveImpl.java:2412)
	at org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerResourceImpl$Bpmn2ModelerXMLSave.saveContainedMany(Bpmn2ModelerResourceImpl.java:862)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1548)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2711)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1176)
	at org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerResourceImpl$Bpmn2ModelerXMLSave.saveElement(Bpmn2ModelerResourceImpl.java:920)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1037)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementFeatureMap(XMLSaveImpl.java:2461)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1513)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1219)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XMLSaveImpl.java:685)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveImpl.java:586)
	at org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerResourceImpl$Bpmn2ModelerXMLSave.traverse(Bpmn2ModelerResourceImpl.java:977)
	at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl.java:251)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLResourceImpl.java:365)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1430)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.saveOnlyIfChangedWithMemoryBuffer(ResourceImpl.java:1144)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:985)
	at org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerResourceImpl.save(Bpmn2ModelerResourceImpl.java:247)
	at org.eclipse.graphiti.ui.internal.services.impl.EmfService$1$1.run(EmfService.java:268)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
	at org.eclipse.graphiti.ui.internal.services.impl.EmfService$1.run(EmfService.java:279)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2327)
	at org.eclipse.graphiti.ui.internal.services.impl.EmfService.save(EmfService.java:286)
	at org.eclipse.graphiti.ui.editor.DefaultPersistencyBehavior.save(DefaultPersistencyBehavior.java:281)
	at org.eclipse.bpmn2.modeler.ui.editor.BPMN2PersistencyBehavior.access$1(BPMN2PersistencyBehavior.java:1)
	at org.eclipse.bpmn2.modeler.ui.editor.BPMN2PersistencyBehavior$1.run(BPMN2PersistencyBehavior.java:75)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

	at org.eclipse.graphiti.ui.internal.services.impl.EmfService.save(EmfService.java:288)
	at org.eclipse.graphiti.ui.editor.DefaultPersistencyBehavior.save(DefaultPersistencyBehavior.java:281)
	at org.eclipse.bpmn2.modeler.ui.editor.BPMN2PersistencyBehavior.access$1(BPMN2PersistencyBehavior.java:1)
	at org.eclipse.bpmn2.modeler.ui.editor.BPMN2PersistencyBehavior$1.run(BPMN2PersistencyBehavior.java:75)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: java.lang.RuntimeException
	... 5 more


What I found is that when I reload the BPMN file, the feature "anyAttribute" of my ServiceTask contains 1 element [ext:customProp=null]. The null value causes the save operation to fail.

Do you know how I could avoid this error ?

Thanks,
Cédric
Re: NullPointerException when saving model with custom attribute [message #1386013 is a reply to message #1385843] Thu, 12 June 2014 23:20 Go to previous messageGo to next message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 701
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Hi Cédric,

Sorry, I don't have time to look into this issue this week - I'm taking a few days off to celebrate my daughters wedding this weekend Very Happy
I'll take a look at this next week. BTW, which version of the editor are you using?

Cheers!
Bob
Re: NullPointerException when saving model with custom attribute [message #1386035 is a reply to message #1386013] Fri, 13 June 2014 07:04 Go to previous messageGo to next message
Cédric Casenove is currently offline Cédric CasenoveFriend
Messages: 22
Registered: December 2013
Junior Member
Hi Bob,

I am still using version 1.0.2.201403061830, because I had some issues with the latest 1.1 version.

I can wait, no problem, I wish your daughter a very happy marriage. Enjoy the celebration !

Re: NullPointerException when saving model with custom attribute [message #1477915 is a reply to message #1386035] Tue, 18 November 2014 08:08 Go to previous message
Damien Dussol is currently offline Damien DussolFriend
Messages: 5
Registered: February 2014
Junior Member
Hi Bob

Do you have any update on this topic ?
I have the same behaviour than Cedric.

thks.
Previous Topic:Videos Offline
Next Topic:Horizontal and vertical pools
Goto Forum:
  


Current Time: Thu Jul 02 10:01:04 GMT 2015

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

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