Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » [Bug?] NPE during comparison of EObjects
[Bug?] NPE during comparison of EObjects [message #1282451] Wed, 02 April 2014 10:24 Go to next message
Florian Zoubek is currently offline Florian ZoubekFriend
Messages: 1
Registered: April 2014
Junior Member
Hello everyone,

I'm trying to compare two EObjects (more precisely two DynamicEObjects) with EMF Compare 3.0.1 and I'm always getting the following NullPointerException:


My code that invokes the comparison looks like this:

	private Comparison compare(Notifier left,
			Notifier right) { 

		// Configure EMF Compare
		IEObjectMatcher matcher = DefaultMatchEngine.createDefaultEObjectMatcher(UseIdentifiers.WHEN_AVAILABLE);
		IComparisonFactory comparisonFactory = new DefaultComparisonFactory(new DefaultEqualityHelperFactory());
		IMatchEngine.Factory matchEngineFactory = new MatchEngineFactoryImpl(	matcher,
		IMatchEngine.Factory.Registry matchEngineRegistry = new MatchEngineFactoryRegistryImpl();
		EMFCompare comparator = EMFCompare.builder()

		// Compare the two models
		IComparisonScope scope = EMFCompare.createDefaultScope(	left,

The right EObject is contained in a ResultSet, the left one is not contained in a ResultSet. Is this a bug or is there something I'm doing wrong?

I know it would be great if I could provide an example to reproduce the problem but I'm not sure how to do that as the model instances are provided through an third party plugin at runtime (and I'm relatively new to EMF & EMF Compare).

Thanks in advance,

Florian Zoubek
Re: [Bug?] NPE during comparison of EObjects [message #1283353 is a reply to message #1282451] Thu, 03 April 2014 10:20 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1895
Registered: July 2009
Senior Member
Hi Florian,

If you use a Resource, we expect it to have a valid URI.

You usually create Resources through ResourceSet.createResource(...) or ResourceSet.getResource(...). Please make sure you do not use the "new ResourceImpl()" constuctor or that you immediately set its URI to a valid value (resource.setURI(...)).

Laurent Goubet
Previous Topic:Best way to combine two attribute changes into a high-level atomic one
Next Topic:Compatibility of version 3?
Goto Forum:

Current Time: Wed Oct 20 19:45:15 GMT 2021

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

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

Back to the top