Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Compare] NullPointerException during merging
[EMF Compare] NullPointerException during merging [message #131634] Thu, 11 December 2008 13:14 Go to next message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Hi all,

today, I've explored the Compare project, which seems to be very easy
and helpfull, if one (like me) has to realize a comparison and merging
behavior. Thus, i tried to get it work, but it fails with a
NullPointerException during merge.

Both models are not conainted in a resource. They are created during
runtime and i have to put all elements, which currently not existing in
the right model (swapGradualTestingModel), from the left model
(testingModel).

The snippet i used was from the Eclipe Wiki:

try {
MatchModel match = MatchService.doContentMatch(this.testingModel,
this.swapGradualTestingModel, Collections.<String, Object> emptyMap());
// Computing differences
DiffModel diff = DiffService.doDiff(match, false);
// Merges all differences from model1 to model2
List<DiffElement> differences = new
ArrayList<DiffElement>(diff.getOwnedElements());
for(DiffElement el:differences){
System.out.println(el.getKind());
}
// MergeService.merge(differences, true);
} catch (ConcurrentModificationException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}

The corresponding Exception trace:

java.lang.NullPointerException
at
org.eclipse.emf.compare.diff.merge.service.MergeFactory.getB estMerger(MergeFactory.java:111)
at
org.eclipse.emf.compare.diff.merge.service.MergeFactory.crea teMerger(MergeFactory.java:79)
at
org.eclipse.emf.compare.diff.merge.service.MergeService.doMe rge(MergeService.java:170)
at
org.eclipse.emf.compare.diff.merge.service.MergeService.merg e(MergeService.java:136)
at
org.eclipse.emf.compare.diff.merge.internal.impl.DiffGroupMe rger.undoInTarget(DiffGroupMerger.java:48)
at
org.eclipse.emf.compare.diff.merge.service.MergeService.doMe rge(MergeService.java:172)
at
org.eclipse.emf.compare.diff.merge.service.MergeService.merg e(MergeService.java:136)
at
de.fraunhofer.fokus.testing.transformation.modelplex.sys2pit .Sys2PITTransformator.copyTemporaryTestContext2PIT(Sys2PITTr ansformator.java:155)


This is my first approach with EMF Compare, so may be, i didn't get the
main concepts.

Any ideas???
Thx
Timothy
Re: [EMF Compare] NullPointerException during merging [message #131648 is a reply to message #131634] Thu, 11 December 2008 13:21 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000407090601050602010906
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hi Timothy,

This isn't a misunderstanding of EMF Compare but indeed an error from
our side. The merger expects each EObject to be contained within a
resource (we try and find the most appropriate merger for specific file
extensions, which are in turn retrieved from the resource). This will be
easily solved yet the CVS version has FIXes pending and isn't stable
enough to be built.

Could you raise a bugzilla for this issue? For now, the only workaround
I can suggest is for you to add the models in "dummy" resources in order
to merge. You can simply create "XMLResourceImpl" instances and add your
models' roots to their getContents() list. The resource itself doesn't
need to be saved, we only expect it to exist and have a non-null URI.

Sorry for the trouble

Laurent Goubet
Obeo

Timothy Marc a
Re: [EMF Compare] NullPointerException during merging [message #131658 is a reply to message #131648] Thu, 11 December 2008 20:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tmothymarc.freenet.de

Dear Laurent,

okay, that could be a possibilty :) I tried it by inserting the model
into a dummy ressource, but it fails again with NPE.

Here's the snippet:


laurent Goubet schrieb:
> Hi Timothy,
>
> This isn't a misunderstanding of EMF Compare but indeed an error from
> our side. The merger expects each EObject to be contained within a
> resource (we try and find the most appropriate merger for specific file
> extensions, which are in turn retrieved from the resource). This will be
> easily solved yet the CVS version has FIXes pending and isn't stable
> enough to be built.
>
> Could you raise a bugzilla for this issue? For now, the only workaround
> I can suggest is for you to add the models in "dummy" resources in order
> to merge. You can simply create "XMLResourceImpl" instances and add your
> models' roots to their getContents() list. The resource itself doesn't
> need to be saved, we only expect it to exist and have a non-null URI.
>
> Sorry for the trouble
>
> Laurent Goubet
> Obeo
>
> Timothy Marc a écrit :
>> Hi all,
>>
>> today, I've explored the Compare project, which seems to be very easy
>> and helpfull, if one (like me) has to realize a comparison and merging
>> behavior. Thus, i tried to get it work, but it fails with a
>> NullPointerException during merge.
>>
>> Both models are not conainted in a resource. They are created during
>> runtime and i have to put all elements, which currently not existing
>> in the right model (swapGradualTestingModel), from the left model
>> (testingModel).
>>
>> The snippet i used was from the Eclipe Wiki:
>>
>> try {
>> MatchModel match =
>> MatchService.doContentMatch(this.testingModel,
>> this.swapGradualTestingModel, Collections.<String, Object> emptyMap());
>> // Computing differences
>> DiffModel diff = DiffService.doDiff(match, false);
>> // Merges all differences from model1 to model2
>> List<DiffElement> differences = new
>> ArrayList<DiffElement>(diff.getOwnedElements());
>> for(DiffElement el:differences){
>> System.out.println(el.getKind());
>> }
>> // MergeService.merge(differences, true);
>> } catch (ConcurrentModificationException e) {
>> e.printStackTrace();
>> } catch (InterruptedException e) {
>> e.printStackTrace();
>> }
>> The corresponding Exception trace:
>>
>> java.lang.NullPointerException
>> at
>> org.eclipse.emf.compare.diff.merge.service.MergeFactory.getB estMerger(MergeFactory.java:111)
>>
>> at
>> org.eclipse.emf.compare.diff.merge.service.MergeFactory.crea teMerger(MergeFactory.java:79)
>>
>> at
>> org.eclipse.emf.compare.diff.merge.service.MergeService.doMe rge(MergeService.java:170)
>>
>> at
>> org.eclipse.emf.compare.diff.merge.service.MergeService.merg e(MergeService.java:136)
>>
>> at
>> org.eclipse.emf.compare.diff.merge.internal.impl.DiffGroupMe rger.undoInTarget(DiffGroupMerger.java:48)
>>
>> at
>> org.eclipse.emf.compare.diff.merge.service.MergeService.doMe rge(MergeService.java:172)
>>
>> at
>> org.eclipse.emf.compare.diff.merge.service.MergeService.merg e(MergeService.java:136)
>>
>> at
>> de.fraunhofer.fokus.testing.transformation.modelplex.sys2pit .Sys2PITTransformator.copyTemporaryTestContext2PIT(Sys2PITTr ansformator.java:155)
>>
>>
>>
>> This is my first approach with EMF Compare, so may be, i didn't get
>> the main concepts.
>>
>> Any ideas???
>> Thx
>> Timothy
>
Re: [EMF Compare] NullPointerException during merging [message #131668 is a reply to message #131648] Thu, 11 December 2008 20:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tmothymarc.freenet.de

Sorry, continuing the post :)

It works now... not as i want it to, but i think this is an logical
issue... if not, i will post again, be sure.

Can you give me an URL for the Bugzilla?

Timothy
Re: [EMF Compare] NullPointerException during merging [message #131678 is a reply to message #131668] Fri, 12 December 2008 09:10 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020105070609040206060505
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

You can raise a bug here
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMFT against the
component "compare". We'll try to have the fix in the next integration
build.

Thanks

Timothy Marc a
Re: [EMF Compare] NullPointerException during merging [message #620535 is a reply to message #131634] Thu, 11 December 2008 13:21 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000407090601050602010906
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hi Timothy,

This isn't a misunderstanding of EMF Compare but indeed an error from
our side. The merger expects each EObject to be contained within a
resource (we try and find the most appropriate merger for specific file
extensions, which are in turn retrieved from the resource). This will be
easily solved yet the CVS version has FIXes pending and isn't stable
enough to be built.

Could you raise a bugzilla for this issue? For now, the only workaround
I can suggest is for you to add the models in "dummy" resources in order
to merge. You can simply create "XMLResourceImpl" instances and add your
models' roots to their getContents() list. The resource itself doesn't
need to be saved, we only expect it to exist and have a non-null URI.

Sorry for the trouble

Laurent Goubet
Obeo

Timothy Marc a
Re: [EMF Compare] NullPointerException during merging [message #620536 is a reply to message #131648] Thu, 11 December 2008 20:05 Go to previous message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Dear Laurent,

okay, that could be a possibilty :) I tried it by inserting the model
into a dummy ressource, but it fails again with NPE.

Here's the snippet:


laurent Goubet schrieb:
> Hi Timothy,
>
> This isn't a misunderstanding of EMF Compare but indeed an error from
> our side. The merger expects each EObject to be contained within a
> resource (we try and find the most appropriate merger for specific file
> extensions, which are in turn retrieved from the resource). This will be
> easily solved yet the CVS version has FIXes pending and isn't stable
> enough to be built.
>
> Could you raise a bugzilla for this issue? For now, the only workaround
> I can suggest is for you to add the models in "dummy" resources in order
> to merge. You can simply create "XMLResourceImpl" instances and add your
> models' roots to their getContents() list. The resource itself doesn't
> need to be saved, we only expect it to exist and have a non-null URI.
>
> Sorry for the trouble
>
> Laurent Goubet
> Obeo
>
> Timothy Marc a écrit :
>> Hi all,
>>
>> today, I've explored the Compare project, which seems to be very easy
>> and helpfull, if one (like me) has to realize a comparison and merging
>> behavior. Thus, i tried to get it work, but it fails with a
>> NullPointerException during merge.
>>
>> Both models are not conainted in a resource. They are created during
>> runtime and i have to put all elements, which currently not existing
>> in the right model (swapGradualTestingModel), from the left model
>> (testingModel).
>>
>> The snippet i used was from the Eclipe Wiki:
>>
>> try {
>> MatchModel match =
>> MatchService.doContentMatch(this.testingModel,
>> this.swapGradualTestingModel, Collections.<String, Object> emptyMap());
>> // Computing differences
>> DiffModel diff = DiffService.doDiff(match, false);
>> // Merges all differences from model1 to model2
>> List<DiffElement> differences = new
>> ArrayList<DiffElement>(diff.getOwnedElements());
>> for(DiffElement el:differences){
>> System.out.println(el.getKind());
>> }
>> // MergeService.merge(differences, true);
>> } catch (ConcurrentModificationException e) {
>> e.printStackTrace();
>> } catch (InterruptedException e) {
>> e.printStackTrace();
>> }
>> The corresponding Exception trace:
>>
>> java.lang.NullPointerException
>> at
>> org.eclipse.emf.compare.diff.merge.service.MergeFactory.getB estMerger(MergeFactory.java:111)
>>
>> at
>> org.eclipse.emf.compare.diff.merge.service.MergeFactory.crea teMerger(MergeFactory.java:79)
>>
>> at
>> org.eclipse.emf.compare.diff.merge.service.MergeService.doMe rge(MergeService.java:170)
>>
>> at
>> org.eclipse.emf.compare.diff.merge.service.MergeService.merg e(MergeService.java:136)
>>
>> at
>> org.eclipse.emf.compare.diff.merge.internal.impl.DiffGroupMe rger.undoInTarget(DiffGroupMerger.java:48)
>>
>> at
>> org.eclipse.emf.compare.diff.merge.service.MergeService.doMe rge(MergeService.java:172)
>>
>> at
>> org.eclipse.emf.compare.diff.merge.service.MergeService.merg e(MergeService.java:136)
>>
>> at
>> de.fraunhofer.fokus.testing.transformation.modelplex.sys2pit .Sys2PITTransformator.copyTemporaryTestContext2PIT(Sys2PITTr ansformator.java:155)
>>
>>
>>
>> This is my first approach with EMF Compare, so may be, i didn't get
>> the main concepts.
>>
>> Any ideas???
>> Thx
>> Timothy
>
Re: [EMF Compare] NullPointerException during merging [message #620537 is a reply to message #131648] Thu, 11 December 2008 20:20 Go to previous message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Sorry, continuing the post :)

It works now... not as i want it to, but i think this is an logical
issue... if not, i will post again, be sure.

Can you give me an URL for the Bugzilla?

Timothy
Re: [EMF Compare] NullPointerException during merging [message #620538 is a reply to message #131668] Fri, 12 December 2008 09:10 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020105070609040206060505
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

You can raise a bug here
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMFT against the
component "compare". We'll try to have the fix in the next integration
build.

Thanks

Timothy Marc a
Previous Topic:[EMF Compare] NullPointerException during merging
Next Topic:Loading a .emfdiff file
Goto Forum:
  


Current Time: Thu Apr 25 20:42:26 GMT 2024

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

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

Back to the top