IllegalStateException [message #163714] |
Mon, 03 December 2007 13:58 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 #163860 is a reply to message #163725] |
Mon, 03 December 2007 16:35 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.03227 seconds