Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Compare(ModelUtils.java (Serialize & Save))
EMF Compare [message #538491] Mon, 07 June 2010 18:26 Go to next message
Fatih Ok is currently offline Fatih OkFriend
Messages: 8
Registered: April 2010
Junior Member
Hello,

i have Errors, if I try to serialize diff- and matchmodel , also by saving emfdiff. I'am using EMF Compare M7a. Is it a bug at ModelUtils ? Can anybody help me pls?


---------------------------------------- Compiler Output --------------------------------------
saving emfdiff as "result.emfdiff"
at org.eclipse.emf.compare.util.ModelUtils.attachResource(Model Utils.java:64)
at org.eclipse.emf.compare.util.ModelUtils.serialize(ModelUtils .java:419)
at org.eclipse.emf.compare.examples.standalone.ExampleLauncher. main(ExampleLauncher.java:120)
java.lang.NullPointerException
at org.eclipse.emf.compare.util.ModelUtils.save(ModelUtils.java :398)
at org.eclipse.emf.compare.examples.standalone.ExampleLauncher. main(ExampleLauncher.java:195)
Re: EMF Compare [message #538624 is a reply to message #538491] Tue, 08 June 2010 08:47 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.
--------------070706050104010402040009
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I don't know if we fixed this or not (I don't recall seeing this trace
.... but we see so many of them... :p). Yet looking at the code at the
lines where you get the NullPointerException, I don't think we can throw
an exception there.

Could you try with the latest release and see if you still get the
exception? (and if you do, provide us with its most recent stack trace?)

Laurent Goubet
Obeo

fatih.ok@gmx.de wrote:
> Hello,
> i have Errors, if I try to serialize diff- and matchmodel , also by
> saving emfdiff. I'am using EMF Compare M7a. Is it a bug at ModelUtils
> ? Can anybody help me pls?
>
>
> ---------------------------------------- Compiler Output
> --------------------------------------
> saving emfdiff as "result.emfdiff"
> at org.eclipse.emf.compare.util.ModelUtils.attachResource(Model
> Utils.java:64)
> at org.eclipse.emf.compare.util.ModelUtils.serialize(ModelUtils
> .java:419)
> at org.eclipse.emf.compare.examples.standalone.ExampleLauncher.
> main(ExampleLauncher.java:120)
> java.lang.NullPointerException
> at org.eclipse.emf.compare.util.ModelUtils.save(ModelUtils.java :398)
> at org.eclipse.emf.compare.examples.standalone.ExampleLauncher.
> main(ExampleLauncher.java:195)


--------------070706050104010402040009
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------070706050104010402040009--
Re: EMF Compare [message #540105 is a reply to message #538624] Mon, 14 June 2010 22:22 Go to previous messageGo to next message
Fatih Ok is currently offline Fatih OkFriend
Messages: 8
Registered: April 2010
Junior Member
I have updated to last version of EMF Compare, but the exception are still there.


----------------------------------------------------
Code :
Line 120: System.out.println(ModelUtils.serialize(match));
Line 157: System.out.println(ModelUtils.serialize(diff));
Line 195: ModelUtils.save(snapshot, "result.emfdiff"); //$NON-NLS-1$
-----------------------------------------------------
Exceptions:


MatchModel :

java.lang.NullPointerException
at org.eclipse.emf.compare.util.ModelUtils.attachResource(Model Utils.java:64)
at org.eclipse.emf.compare.util.ModelUtils.serialize(ModelUtils .java:419)
at org.eclipse.emf.compare.examples.standalone.ExampleLauncher. main(ExampleLauncher.java:120)

DiffModel :

java.lang.NullPointerException
at org.eclipse.emf.compare.util.ModelUtils.attachResource(Model Utils.java:64)
at org.eclipse.emf.compare.util.ModelUtils.serialize(ModelUtils .java:419)
at org.eclipse.emf.compare.examples.standalone.ExampleLauncher. main(ExampleLauncher.java:157)


saving emfdiff as "result.emfdiff"
java.lang.NullPointerException
at org.eclipse.emf.compare.util.ModelUtils.save(ModelUtils.java :398)
at org.eclipse.emf.compare.examples.standalone.ExampleLauncher. main(ExampleLauncher.java:195)
Re: EMF Compare [message #540315 is a reply to message #540105] Tue, 15 June 2010 15:29 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.
--------------010200040804050104030602
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I see ... :'(. This is a regression I introduced back in April and that
we didn't notice until now. Could you raise a bug on the Eclipse
bugzilla with either one of these traces?

For now, you can work around the issue by adding something like this
before your first "serialize" :

Resource.Factory.Registry.getExtensionToFactoryMap().put("xml ", new
XMIResourceFactoryImpl());

and before your Line 195 (saving the emfdiff) :

Resource.Factory.Registry.getExtensionToFactoryMap().put("emfdiff ", new
XMIResourceFactoryImpl());

Please raise the bug anyway, so that we can track this and remember to
fix it asap.

Laurent Goubet
Obeo

fatih.ok@gmx.de wrote:
> I have updated to last version of EMF Compare, but the exception are
> still there.
>
> ----------------------------------------------------
> Code :
> Line 120: System.out.println(ModelUtils.serialize(match));
> Line 157: System.out.println(ModelUtils.serialize(diff));
> Line 195: ModelUtils.save(snapshot, "result.emfdiff"); //$NON-NLS-1$
> -----------------------------------------------------
> Exceptions:
>
>
> MatchModel :
>
> java.lang.NullPointerException
> at org.eclipse.emf.compare.util.ModelUtils.attachResource(Model
> Utils.java:64)
> at org.eclipse.emf.compare.util.ModelUtils.serialize(ModelUtils
> .java:419)
> at org.eclipse.emf.compare.examples.standalone.ExampleLauncher.
> main(ExampleLauncher.java:120)
>
> DiffModel :
>
> java.lang.NullPointerException
> at org.eclipse.emf.compare.util.ModelUtils.attachResource(Model
> Utils.java:64)
> at org.eclipse.emf.compare.util.ModelUtils.serialize(ModelUtils
> .java:419)
> at org.eclipse.emf.compare.examples.standalone.ExampleLauncher.
> main(ExampleLauncher.java:157)
>
>
> saving emfdiff as "result.emfdiff"
> java.lang.NullPointerException
> at org.eclipse.emf.compare.util.ModelUtils.save(ModelUtils.java :398)
> at org.eclipse.emf.compare.examples.standalone.ExampleLauncher.
> main(ExampleLauncher.java:195)


--------------010200040804050104030602
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------010200040804050104030602--
Re: EMF Compare [message #540391 is a reply to message #540315] Wed, 16 June 2010 00:46 Go to previous messageGo to next message
Fatih Ok is currently offline Fatih OkFriend
Messages: 8
Registered: April 2010
Junior Member
Hi,

after adding following line can i serialize diff and match model.

Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xml ", new
XMIResourceFactoryImpl());


But

adding following line after line 197 (saving the emfdiff) doesn't help.

Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "emfdiff ", new
XMIResourceFactoryImpl());

The exception is still there. I can see now the diff and match model , but i can't save it.


---------------------------- Source ------------------------------
Line 197: ModelUtils.save(snapshot, "result.emfdiff"); //$NON-NLS-1$

----------------------------Exception -----------------------------


Exception in thread "main" java.lang.NullPointerException
at org.eclipse.emf.compare.util.ModelUtils.save(ModelUtils.java :398)
at org.eclipse.emf.compare.examples.standalone.ExampleLauncher. main(ExampleLauncher.java:197)
------------------------------------------------------------ -----------






Laurent Goubet wrote on Tue, 15 June 2010 11:29
This is a multi-part message in MIME format.
--------------010200040804050104030602
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I see ... :'(. This is a regression I introduced back in April and that
we didn't notice until now. Could you raise a bug on the Eclipse
bugzilla with either one of these traces?

For now, you can work around the issue by adding something like this
before your first "serialize" :

Resource.Factory.Registry.getExtensionToFactoryMap().put("xml ", new
XMIResourceFactoryImpl());

and before your Line 195 (saving the emfdiff) :

Resource.Factory.Registry.getExtensionToFactoryMap().put("emfdiff ", new
XMIResourceFactoryImpl());

Please raise the bug anyway, so that we can track this and remember to
fix it asap.

Laurent Goubet
Obeo

fatih.ok@gmx.de wrote:
> I have updated to last version of EMF Compare, but the exception are
> still there.
>
> ----------------------------------------------------
> Code :
> Line 120: System.out.println(ModelUtils.serialize(match));
> Line 157: System.out.println(ModelUtils.serialize(diff));
> Line 195: ModelUtils.save(snapshot, "result.emfdiff"); //$NON-NLS-1$
> -----------------------------------------------------
> Exceptions:
>
>
> MatchModel :
>
> java.lang.NullPointerException
> at org.eclipse.emf.compare.util.ModelUtils.attachResource(Model
> Utils.java:64)
> at org.eclipse.emf.compare.util.ModelUtils.serialize(ModelUtils
> .java:419)
> at org.eclipse.emf.compare.examples.standalone.ExampleLauncher.
> main(ExampleLauncher.java:120)
>
> DiffModel :
>
> java.lang.NullPointerException
> at org.eclipse.emf.compare.util.ModelUtils.attachResource(Model
> Utils.java:64)
> at org.eclipse.emf.compare.util.ModelUtils.serialize(ModelUtils
> .java:419)
> at org.eclipse.emf.compare.examples.standalone.ExampleLauncher.
> main(ExampleLauncher.java:157)
>
>
> saving emfdiff as "result.emfdiff"
> java.lang.NullPointerException
> at org.eclipse.emf.compare.util.ModelUtils.save(ModelUtils.java :398)
> at org.eclipse.emf.compare.examples.standalone.ExampleLauncher.
> main(ExampleLauncher.java:195)


--------------010200040804050104030602
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------010200040804050104030602--

Re: EMF Compare [message #540793 is a reply to message #540391] Thu, 17 June 2010 11:48 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.
--------------090608000808070003020208
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

> adding following line after line 197 (saving the emfdiff) doesn't help.

This line must be added _before_ the call to "ModelUtils.save(snapshot,
"result.emfdiff")"; otherwise it'll have no effect

Laurent Goubet
Obeo

fatih.ok@gmx.de wrote:
> Hi,
> after adding following line can i serialize diff and match model.
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xml
> ", new XMIResourceFactoryImpl());
>
>
> But
> adding following line after line 197 (saving the emfdiff) doesn't help.
>
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put(
> "emfdiff ", new XMIResourceFactoryImpl());
>
> The exception is still there. I can see now the diff and match model ,
> but i can't save it.
>
>
> ---------------------------- Source ------------------------------
> Line 197: ModelUtils.save(snapshot, "result.emfdiff"); //$NON-NLS-1$
>
> ----------------------------Exception -----------------------------
>
>
> Exception in thread "main" java.lang.NullPointerException
> at org.eclipse.emf.compare.util.ModelUtils.save(ModelUtils.java :398)
> at org.eclipse.emf.compare.examples.standalone.ExampleLauncher.
> main(ExampleLauncher.java:197)
> ------------------------------------------------------------ -----------
>
>
>
>
>
>
> Laurent Goubet wrote on Tue, 15 June 2010 11:29
>> This is a multi-part message in MIME format.
>> --------------010200040804050104030602
>> Content-Type: text/plain; charset=UTF-8; format=flowed
>> Content-Transfer-Encoding: 7bit
>>
>> Hi,
>>
>> I see ... :'(. This is a regression I introduced back in April and
>> that we didn't notice until now. Could you raise a bug on the Eclipse
>> bugzilla with either one of these traces?
>>
>> For now, you can work around the issue by adding something like this
>> before your first "serialize" :
>>
>> Resource.Factory.Registry.getExtensionToFactoryMap().put("xml ", new
>> XMIResourceFactoryImpl());
>>
>> and before your Line 195 (saving the emfdiff) :
>>
>> Resource.Factory.Registry.getExtensionToFactoryMap().put("emfdiff ",
>> new XMIResourceFactoryImpl());
>>
>> Please raise the bug anyway, so that we can track this and remember to
>> fix it asap.
>>
>> Laurent Goubet
>> Obeo
>>
>> fatih.ok@gmx.de wrote:
>> > I have updated to last version of EMF Compare, but the exception are
>> > still there.
>> > > ----------------------------------------------------
>> > Code :
>> > Line 120: System.out.println(ModelUtils.serialize(match));
>> > Line 157: System.out.println(ModelUtils.serialize(diff));
>> > Line 195: ModelUtils.save(snapshot, "result.emfdiff"); //$NON-NLS-1$
>> > -----------------------------------------------------
>> > Exceptions:
>> > > > MatchModel :
>> > > java.lang.NullPointerException
>> > at
>> org.eclipse.emf.compare.util.ModelUtils.attachResource(Model >
>> Utils.java:64)
>> > at
>> org.eclipse.emf.compare.util.ModelUtils.serialize(ModelUtils > .java:419)
>> > at
>> org.eclipse.emf.compare.examples.standalone.ExampleLauncher. >
>> main(ExampleLauncher.java:120)
>> > > DiffModel :
>> > > java.lang.NullPointerException
>> > at
>> org.eclipse.emf.compare.util.ModelUtils.attachResource(Model >
>> Utils.java:64)
>> > at
>> org.eclipse.emf.compare.util.ModelUtils.serialize(ModelUtils > .java:419)
>> > at
>> org.eclipse.emf.compare.examples.standalone.ExampleLauncher. >
>> main(ExampleLauncher.java:157)
>> > > > saving emfdiff as "result.emfdiff"
>> > java.lang.NullPointerException
>> > at
>> org.eclipse.emf.compare.util.ModelUtils.save(ModelUtils.java :398)
>> > at
>> org.eclipse.emf.compare.examples.standalone.ExampleLauncher. >
>> main(ExampleLauncher.java:195)
>>
>>
>> --------------010200040804050104030602
>> Content-Type: text/x-vcard; charset=utf-8;
>> name="laurent_goubet.vcf"
>> Content-Transfer-Encoding: base64
>> Content-Disposition: attachment;
>> filename="laurent_goubet.vcf"
>>
>> YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy
>> ZW50DQpvcmc6
>> PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7
>> aW50ZXJuZXQ6
>> bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m
>> cg0KdmVyc2lv
>> bjoyLjENCmVuZDp2Y2FyZA0KDQo=
>> --------------010200040804050104030602--
>
>


--------------090608000808070003020208
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------090608000808070003020208--
Re: EMF Compare [message #541027 is a reply to message #540793] Fri, 18 June 2010 06:48 Go to previous messageGo to next message
Fatih Ok is currently offline Fatih OkFriend
Messages: 8
Registered: April 2010
Junior Member
Hi,



>> adding following line after line 197 (saving the emfdiff) doesn't help.

>This line must be added _before_ the call to "ModelUtils.save(snapshot,
>"result.emfdiff")"; otherwise it'll have no effect


sorry i misstyped. I mean , adding _before_ line 197, doesn't help.

Fatih
Re: EMF Compare [message #541063 is a reply to message #541027] Fri, 18 June 2010 08:14 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.
--------------050402040602080100080201
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Fatih,

Humm ... in this case I must admit I don't understand. The only
"NPE-prone" thing in there is that missing factory registration. You're
sure you're really registering the "new XMIResourceFactoryImpl()"
against extension "emdiff" (without spaces nor anything)?

The extension you use for line

Resource.Factory.Registry.getExtensionToFactoryMap().put(<extension >,
new XMIResourceFactoryImpl());

must match the extension of the URI you have on the line :

ModelUtils.save(snapshot, "result." + <extension>);

if the two indeed match ... I can't understand why you would get such an
exception. What would it do if you used something like

ModelUtils.save(snapshot, "result.xml");

instead (thus using an extension you registered above)?

Laurent Goubet
Obeo

fatih.ok@gmx.de wrote:
> Hi,
>
>
>
>>> adding following line after line 197 (saving the emfdiff) doesn't help.
>
>> This line must be added _before_ the call to "ModelUtils.save(snapshot,
>> "result.emfdiff")"; otherwise it'll have no effect
>
>
> sorry i misstyped. I mean , adding _before_ line 197, doesn't help.
> Fatih


--------------050402040602080100080201
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------050402040602080100080201--
Re: EMF Compare [message #541240 is a reply to message #541063] Fri, 18 June 2010 20:51 Go to previous message
Fatih Ok is currently offline Fatih OkFriend
Messages: 8
Registered: April 2010
Junior Member
Thank you. There was a space in <Extension> String. It's working now Smile
Previous Topic:Ecore as its own metamodel
Next Topic:[CDO] modification of cdo objects from a view
Goto Forum:
  


Current Time: Fri Apr 26 16:35:51 GMT 2024

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

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

Back to the top