Skip to main content



      Home
Home » Modeling » Compare » Bug on org.eclipse.emf.compare.ide.ui.internal.logical.EMFResourceMapping
Bug on org.eclipse.emf.compare.ide.ui.internal.logical.EMFResourceMapping [message #1065584] Wed, 26 June 2013 11:05 Go to next message
Eclipse UserFriend
Hi guys,

we recently introduced the RCP/IDE/UI bundles of the EMF Compare 2.1.0 release into our product and found that for some reason CVS commits (our app does it programatically) were failing with an NPE. I also managed to reproduce it by:

1. Create an empty project
2. add an ecore model to this project
3. commit to CVS

This is the exception:

java.lang.NullPointerException
	at org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation$TraversalMapEntry.add(RepositoryProviderOperation.java:87)
	at org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation.getProviderTraversalMapping(RepositoryProviderOperation.java:338)
	at org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation.execute(RepositoryProviderOperation.java:204)
	at org.eclipse.team.internal.ccvs.ui.operations.CVSOperation.run(CVSOperation.java:81)
	at org.eclipse.team.internal.ccvs.ui.wizards.CommitWizard$AddAndCommitOperation.execute(CommitWizard.java:99)
	at org.eclipse.team.internal.ccvs.ui.operations.CVSOperation.run(CVSOperation.java:81)
	at org.eclipse.team.internal.ui.actions.JobRunnableContext.run(JobRunnableContext.java:144)
	at org.eclipse.team.internal.ui.actions.JobRunnableContext$ResourceJob.runInWorkspace(JobRunnableContext.java:72)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


The bug is caused by an issue in org.eclipse.emf.compare.ide.ui.internal.logical.EMFResourceMapping.getModelObject()

Each time getModelObject() is called, a new Resource instance is created.
Unfortunatelly enough, ResourceMapping.hashCode() is overriden, and the hashcode is calculated from the getModelObject() returned value hashcode. Since this method returns a new instance each time is called, a new hashcode is returned eachtime anything ask for it (for instance, Java Map.put() and Map.get() implementations make use of hashcode).

Given the above scenario, any map.get() call would fail on getting a EMFResourceMapping instance.

The proposed solution is (pretty much like WorkspaceResourceMapper does) to cache the Resource instance returned by getModelObject().

Should I submit a bugzilla?

Cheers,
Víctor.
Re: Bug on org.eclipse.emf.compare.ide.ui.internal.logical.EMFResourceMapping [message #1066351 is a reply to message #1065584] Tue, 02 July 2013 05:21 Go to previous messageGo to next message
Eclipse UserFriend
Víctor,

yes, please raise a bugzilla for this, this sounds like quite a blocker. Unfortunately, most Eclipse projects switched to git, so this hasn't been detected soon enough for Kepler.

Laurent Goubet
Obeo
Re: Bug on org.eclipse.emf.compare.ide.ui.internal.logical.EMFResourceMapping [message #1066365 is a reply to message #1066351] Tue, 02 July 2013 06:55 Go to previous message
Eclipse UserFriend
Created: NPE in CVS Team Support due to EMFResourceMapping https://bugs.eclipse.org/bugs/show_bug.cgi?id=412088
Previous Topic:Missing sources on 2.1.0 release
Next Topic:NoSuchMethodError on EMFCompareStructureMergeViewer.createToolItems()
Goto Forum:
  


Current Time: Wed Jul 23 07:39:10 EDT 2025

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

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

Back to the top