Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » change recorder error eliminateEmptyChanges()(change recorder error eliminateEmptyChanges())
change recorder error eliminateEmptyChanges() [message #1815471] Thu, 03 October 2019 08:36 Go to next message
Anthony Garmendia is currently offline Anthony GarmendiaFriend
Messages: 48
Registered: May 2014
Member
Hi,

I just recently started working with EMF Change Model. I made an example that captures automatically the changes in the model when it is edited in a tree-based editor.

The problem arises when I do the following steps:

1. Add object "A"
2. Save Model and recorder.summarize()
3. Delete object "A" and the following error appears:

java.lang.NullPointerException
at org.eclipse.emf.ecore.change.util.BasicChangeRecorder.eliminateEmptyChanges(BasicChangeRecorder.java:161)
at org.mondo.visualization.ui.save.vpchanges.ChangeRecorderNew.eliminateEmptyChanges(ChangeRecorderNew.java:58)
at org.eclipse.emf.ecore.change.util.BasicChangeRecorder.consolidateChanges(BasicChangeRecorder.java:143)

It seems to me that the issue comes from the method eliminateEmptyChanges(). I debug the method and find out that when the changes of the object are iterated the variable eObject is equal to null (that is because the object was deleted previously). So, I add the following if in the method.

if (eObject == null) {
	    	  i.remove();
	      } else {
		      for (Iterator<FeatureChange> j = featureChanges.iterator(); j.hasNext(); )
...


I do not know if this is a bug or the recorder simply do not expect that addition and deletion of the same object can occur in the same change description, and due to this, the changes should be recorded in another change description. Would you clarify me with this issue? Thanks in advance.

Cheers,
Anthony
Re: change recorder error eliminateEmptyChanges() [message #1815475 is a reply to message #1815471] Thu, 03 October 2019 09:49 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30681
Registered: July 2009
Senior Member
I have no way to know what org.mondo.visualization.ui.save.vpchanges.ChangeRecorderNew.eliminateEmptyChanges(ChangeRecorderNew.java:58) is doing and whether it has corrupted the map. Obviously the base framework is not expecting that the map's key might be null, nor does in put null into the map itself, at least as far as I know. Did ChangeRecorderNew.eliminateEmptyChanges put null into the map? I can't know that so I can't know if there is a bug in the EMF framework or in ChangeRecorderNew.eliminateEmptyChanges. I'll assume the latter unless there is a test case using only EMF that demonstrates otherwise.
Re: change recorder error eliminateEmptyChanges() [message #1815538 is a reply to message #1815475] Fri, 04 October 2019 11:37 Go to previous messageGo to next message
Anthony Garmendia is currently offline Anthony GarmendiaFriend
Messages: 48
Registered: May 2014
Member
Hi Ed,

Thanks for your answer. I was implementing a Junit as an example when I realized the error in my code. So, it is fixed. Thanks again.

Cheers,
Antonio
Re: change recorder error eliminateEmptyChanges() [message #1815546 is a reply to message #1815538] Fri, 04 October 2019 13:16 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30681
Registered: July 2009
Senior Member
Thanks for the reassuring update :-)
Previous Topic:Ecore Generate Problem by creating EMF Project
Next Topic:custom createItemPropertyDescriptor
Goto Forum:
  


Current Time: Thu Dec 05 22:11:08 GMT 2019

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

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

Back to the top