Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EDAPT] Issue when using 'load resource'
[EDAPT] Issue when using 'load resource' [message #1415184] Tue, 02 September 2014 09:10 Go to next message
Joerg Hermann is currently offline Joerg HermannFriend
Messages: 15
Registered: September 2012
Location: Munich
Junior Member
I hope this is the correct forum for edapt related questions...

I get a NullPointerException when running the migration on a model at
MigrationReconstructor$MigrationReconstructorSwitch(EcoreReconstructorSwitchBase<E>).create(EObject, EReference, EClass) line: 97, when the 'add()' method is invoked.
This happens, when the doReconstruct() is performed on the 2nd release in my history containing
an additionally loaded resource (Composite Change adding the entire meta model).
In my setup I have a base model (*.ecore) in which I have a single reference to an element in a second model.

To exclude mismatches in the history, I tried to start from the scratch as follows:
* Removed the existing history
* Removed the reference to the 2nd model
* Create History (I now have the Composite change covering my base model)
* Release (let's call it V1)
* Load Resource (my 2nd model; this creates another Composite change containing the elements of this model)
* Create Reference from a class of the base model to a class of the 2nd model
* Release (let's call it V2)

Now loading a model that requires migration from V1 to V2 throws the above mentioned NullpointerException when the Composite Change for the 2nd model is processed, more precisely on the first change that should create the EPackage.

When I move the Composite change for the 2nd model to the initial release, everything works fine.
I would expect that adding resources should be possible at any stage...

What am I doing wrong?


-
best regards,
Joerg

Re: [EDAPT] Issue when using 'load resource' [message #1420876 is a reply to message #1415184] Wed, 10 September 2014 16:02 Go to previous messageGo to next message
Maximilian Koegel is currently offline Maximilian KoegelFriend
Messages: 253
Registered: July 2009
Senior Member
Hi Jörg,

I just saw your post accidentally. A better forum for your question is
the EMFT newsgroup:
https://www.eclipse.org/forums/index.php/f/19/
I just added a task for Edapt to reflect this correctly on the Webpage.

Concerning your question, could you please provide the Stacktrace.
Anyway I think in the current implementation it is not possible to add
new metamodels to the history in later revisions and your fix is a valid
workaround.

Cheers,
Maximilian

--
Maximilian Kögel

Get Professional Eclipse Support: http://eclipsesource.com/munich

Am 02.09.2014 11:10, schrieb Joerg Hermann:
> I hope this is the correct forum for edapt related questions...
>
> I get a NullPointerException when running the migration on a model at
> MigrationReconstructor$MigrationReconstructorSwitch(EcoreReconstructorSwitchBase<E>).create(EObject,
> EReference, EClass) line: 97, when the 'add()' method is invoked.
> This happens, when the doReconstruct() is performed on the 2nd release
> in my history containing
> an additionally loaded resource (Composite Change adding the entire meta
> model).
> In my setup I have a base model (*.ecore) in which I have a single
> reference to an element in a second model.
>
> To exclude mismatches in the history, I tried to start from the scratch
> as follows:
> * Removed the existing history
> * Removed the reference to the 2nd model
> * Create History (I now have the Composite change covering my base model)
> * Release (let's call it V1)
> * Load Resource (my 2nd model; this creates another Composite change
> containing the elements of this model)
> * Create Reference from a class of the base model to a class of the 2nd
> model
> * Release (let's call it V2)
>
> Now loading a model that requires migration from V1 to V2 throws the
> above mentioned NullpointerException when the Composite Change for the
> 2nd model is processed, more precisely on the first change that should
> create the EPackage.
>
> When I move the Composite change for the 2nd model to the initial
> release, everything works fine.
> I would expect that adding resources should be possible at any stage...
>
> What am I doing wrong?
>
> -
> best regards,
> Joerg
>
>
Re: [EDAPT] Issue when using 'load resource' [message #1421533 is a reply to message #1415184] Thu, 11 September 2014 13:49 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
On 02-09-14 11:10, Joerg Hermann wrote:
> I hope this is the correct forum for edapt related questions...
>
> I get a NullPointerException when running the migration on a model at
> MigrationReconstructor$MigrationReconstructorSwitch(EcoreReconstructorSwitchBase<E>).create(EObject,
> EReference, EClass) line: 97, when the 'add()' method is invoked.
Are you on the latest Edapt version? line 97 doesn't point to the
Reconstructor switch. A stacktrace would be handy.

http://git.eclipse.org/c/edapt/org.eclipse.emf.edapt.git/tree/plugins/org.eclipse.emf.edapt.history/src/org/eclipse/emf/edapt/migration/execution/MigrationReconstructor.java#n97


> This happens, when the doReconstruct() is performed on the 2nd release
> in my history containing

> an additionally loaded resource (Composite Change adding the entire meta
> model).
I am not positive this use case will work. Considering that Edapt
constructs a metamodel incrementally. So the orginal ecore (And it's
references) are reconstructed from the Composite change in the History.
When a 2nd release comes along, whith a Composite change, the Metamodel
reconstruction process is appearantly not capable to maintain the state.
(I mean constructing a meta-model in two different passes). The idea
is to have Migratable changes from release 2 onwards. (Which affect an
actual model). One could argue that modifications on the original Ecore
is the whole point, but something like a reference to another Ecore has
perhaps never been tested. I can't recall seeing this scenario in the
documentation or unit tests....

Would you please be so kind to log a bug for this. We could support the
scenario, or catch it and preempt it, if we don't want to support it.
(Load resource won't be allowed, when we have a 2nd release). A test
case building on the existing test framework would be good. (See
org.eclipse.emf.edapt.tests/data for examples), which would indeed
reproduce the issue you describe.

Thank You.
See also:

http://modelmoo.blogspot.nl/2013/12/how-edapt-works.html



> In my setup I have a base model (*.ecore) in which I have a single
> reference to an element in a second model.
>
> To exclude mismatches in the history, I tried to start from the scratch
> as follows:
> * Removed the existing history
> * Removed the reference to the 2nd model
> * Create History (I now have the Composite change covering my base model)
> * Release (let's call it V1)
> * Load Resource (my 2nd model; this creates another Composite change
> containing the elements of this model)
> * Create Reference from a class of the base model to a class of the 2nd
> model

I think this is the problematic part.

> * Release (let's call it V2)
>
> Now loading a model that requires migration from V1 to V2 throws the
> above mentioned NullpointerException when the Composite Change for the
> 2nd model is processed, more precisely on the first change that should
> create the EPackage.
>
> When I move the Composite change for the 2nd model to the initial
> release, everything works fine.
> I would expect that adding resources should be possible at any stage...
>
> What am I doing wrong?
>
> -
> best regards,
> Joerg
>
>
Re: [EDAPT] Issue when using 'load resource' [message #1421551 is a reply to message #1421533] Thu, 11 September 2014 14:10 Go to previous message
Joerg Hermann is currently offline Joerg HermannFriend
Messages: 15
Registered: September 2012
Location: Munich
Junior Member
Hi Maximilian and Christophe,
thanks a lot for your responses...
I will work on a simple example as reference to reproduce and to be attached to the bug report as you have suggested.
I will not be able to do this before next week. I will post a reference to the submitted bug in this thread then...
Again, thanks a lot,
Joerg
Previous Topic:Call for Submissions: Modeling Symposium ECE 2014
Next Topic:Exception during CDO commit
Goto Forum:
  


Current Time: Fri Apr 19 07:31:37 GMT 2024

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

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

Back to the top