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 |
Timothy Marc 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 |
|
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 |
Eclipse User |
|
|
|
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 #620535 is a reply to message #131634] |
Thu, 11 December 2008 13:21 |
|
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 |
Timothy Marc 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
>
|
|
| | |
Goto Forum:
Current Time: Thu Apr 25 20:42:26 GMT 2024
Powered by FUDForum. Page generated in 0.03887 seconds
|