Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » IllegalStateException
IllegalStateException [message #163714] Mon, 03 December 2007 13:58 Go to next message
Eclipse UserFriend
Originally posted by: michael.dev.NOSPAM.gmx.de

Hello all,

I have two semantic models (A and B) created by importing xml schemas. I
want to create a reference from model A to a node from model B. I load
the elements from model B with a resourceset and fetch the element that
I want to reference. Now I set the reference property of the element
from model A to this fetched node from model B. I do this in a
RecordingCommand.

When I save the diagram now I get an IllegalStateException. The "funny"
thing is if I hit ok on the dialog showing "Cannot modify resource set
without a write transaction" and hit "save" again, everything works as
expected. The reference is correctly created in the model file. By the
way, there is no notation for those references.

The exception is thrown when emf tries to put the namespace of model B
in the xmlnsPrefixMap in XMLSaveImpl.endSave(List<? extends EObject>
contents).

I read many documentation/messages but don't understand yet what I am
doing wrong.

Thanks for any hints.
Michael
Re: IllegalStateException [message #163725 is a reply to message #163714] Mon, 03 December 2007 14:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Michael,

I've seen this issue before. The problem is that folks assume that a
save operation is a read-only transaction. It sounds almost like an
oxymoron that a write should be read-only, but of course that makes
sense because we are talking about whether a save modifies the model or
just reads it. Unfortunately, as part of saving a resource containing
an DocumentRoot, the prefixes used to save the document are recorded in
the DocumentRoot's XMLNSPrefix map (to ensure that if the document is
saved again, the same prefixes will be used, which is also why saving a
second time works correctly). This breaks the assumption of needing
just a read-only transaction for save. It might be best to always make
save use a read-write transaction in general or to ensure that the
generator takes the fact that there is a document root into account and
generates code to use a read-write transaction for that case.
Unfortunately I still don't know GMF well enough to say where to
specialize the code to change this. :-(


Michael wrote:
> Hello all,
>
> I have two semantic models (A and B) created by importing xml schemas.
> I want to create a reference from model A to a node from model B. I
> load the elements from model B with a resourceset and fetch the
> element that I want to reference. Now I set the reference property of
> the element from model A to this fetched node from model B. I do this
> in a RecordingCommand.
>
> When I save the diagram now I get an IllegalStateException. The
> "funny" thing is if I hit ok on the dialog showing "Cannot modify
> resource set without a write transaction" and hit "save" again,
> everything works as expected. The reference is correctly created in
> the model file. By the way, there is no notation for those references.
>
> The exception is thrown when emf tries to put the namespace of model B
> in the xmlnsPrefixMap in XMLSaveImpl.endSave(List<? extends EObject>
> contents).
>
> I read many documentation/messages but don't understand yet what I am
> doing wrong.
>
> Thanks for any hints.
> Michael
Re: IllegalStateException [message #163788 is a reply to message #163725] Mon, 03 December 2007 15:44 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Ed,

> or just reads it. Unfortunately, as part of saving a resource
> containing an DocumentRoot, the prefixes used to save the document are
> recorded in the DocumentRoot's XMLNSPrefix map (to ensure that if the
> document is saved again, the same prefixes will be used, which is also
> why saving a second time works correctly). This breaks the assumption
> of needing just a read-only transaction for save. It might be best to
In this case we should modify GMF generator to perform save within write
transaction.

Michael, can you please submitt a bugzilla entry describing this problem
for GMF?

> case. Unfortunately I still don't know GMF well enough to say where
> to specialize the code to change this. :-(
I think, the proper place to modify (introduce write transaction) is generated
???DocumentProvider.doSaveDocument() mthod.

-----------------
Alex Shatalin
Re: IllegalStateException [message #163860 is a reply to message #163725] Mon, 03 December 2007 16:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: michael.dev.NOSPAM.gmx.de

Hello Ed,

thank you for your fast answer. This already helps me a lot.

Michael

Ed Merks schrieb:
> Michael,
>
> I've seen this issue before. The problem is that folks assume that a
> save operation is a read-only transaction. It sounds almost like an
> oxymoron that a write should be read-only, but of course that makes
> sense because we are talking about whether a save modifies the model or
> just reads it. Unfortunately, as part of saving a resource containing
> an DocumentRoot, the prefixes used to save the document are recorded in
> the DocumentRoot's XMLNSPrefix map (to ensure that if the document is
> saved again, the same prefixes will be used, which is also why saving a
> second time works correctly). This breaks the assumption of needing
> just a read-only transaction for save. It might be best to always make
> save use a read-write transaction in general or to ensure that the
> generator takes the fact that there is a document root into account and
> generates code to use a read-write transaction for that case.
> Unfortunately I still don't know GMF well enough to say where to
> specialize the code to change this. :-(
Re: IllegalStateException [message #164086 is a reply to message #163788] Tue, 04 December 2007 11:21 Go to previous message
Eclipse UserFriend
Originally posted by: michael.dev.NOSPAM.gmx.de

Thanks for you help!

>> or just reads it. Unfortunately, as part of saving a resource
>> containing an DocumentRoot, the prefixes used to save the document are
>> recorded in the DocumentRoot's XMLNSPrefix map (to ensure that if the
>> document is saved again, the same prefixes will be used, which is also
>> why saving a second time works correctly). This breaks the assumption
>> of needing just a read-only transaction for save. It might be best to
> In this case we should modify GMF generator to perform save within write
> transaction.

> Michael, can you please submitt a bugzilla entry describing this problem
> for GMF?
I created bug 211863. I hope it describes the problem good enough.
Previous Topic:Error in Mapping Model after Transform
Next Topic:Override palettefactory
Goto Forum:
  


Current Time: Tue Apr 16 04:47:28 GMT 2024

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

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

Back to the top