Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Edapt] Adding a new EPackage cause NPE during Migration
[Edapt] Adding a new EPackage cause NPE during Migration [message #1852386] Fri, 13 May 2022 12:00 Go to next message
Sonja Riethig is currently offline Sonja RiethigFriend
Messages: 4
Registered: May 2019
Junior Member
Hi everyone,

we have a EMF/GMF/Edapt project with a long history.
There are already three separate ecore packages all tracked by one edapt history file.

Now we wanted to add a new ecore package but when edapt runs into the migration step "EPackage {foo} has been created" the migration fails with a NullPointerException:

Caused by: java.lang.NullPointerException: null
	at org.eclipse.emf.edapt.history.reconstruction.EcoreReconstructorSwitchBase.add(EcoreReconstructorSwitchBase.java:49)
	at org.eclipse.emf.edapt.history.reconstruction.EcoreReconstructorSwitchBase.create(EcoreReconstructorSwitchBase.java:95)
	at org.eclipse.emf.edapt.internal.migration.execution.internal.MigrationReconstructor$MigrationReconstructorSwitch.caseCreate(MigrationReconstructor.java:388)


When debugging you can see that the MigrationConstructor wants to create the package but the EContainer and the reference are null. Basically the new EPackage is dangling in the air and can't be created.

Is adding a new package possible? And if so, what do we have to do to resolve the NPE?


Thanks in advance :-)
Re: [Edapt] Adding a new EPackage cause NPE during Migration [message #1862358 is a reply to message #1852386] Tue, 28 November 2023 11:34 Go to previous messageGo to next message
Roland Fahlbusch is currently offline Roland FahlbuschFriend
Messages: 5
Registered: November 2023
Junior Member
I am having the same issue when initially creating the history.

The first entry of the CompositeChange is:
EPackage {B} has been created

Same as with the EPackage that was created before, which worked.

But then when migrating the element of the Change(CreateImpl) is an EObject instead of an EPackage and i get a similar NPE

How did you solve it?

*EDIT* FUrther analysis showed that:
@Override
	public EObject getElement() {
		if (element != null && element.eIsProxy()) {
			final InternalEObject oldElement = (InternalEObject) element;
			element = eResolveProxy(oldElement);
			if (element != oldElement) {
				if (eNotificationRequired()) {
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, HistoryPackage.NON_DELETE__ELEMENT,
						oldElement, element));
				}
			}
		}
		return element;
	}


the function eResolveProxy puts the EPackage correctly for A but an Proxy EObject for B. No idea why.

[Updated on: Tue, 28 November 2023 16:08]

Report message to a moderator

Re: [Edapt] Adding a new EPackage cause NPE during Migration [message #1862375 is a reply to message #1862358] Wed, 29 November 2023 12:27 Go to previous message
Roland Fahlbusch is currently offline Roland FahlbuschFriend
Messages: 5
Registered: November 2023
Junior Member
The problem i had is that plugin A was wrongly named in the manifest.
Note that i have the ecore located under A.model/a.ecore

The Bundle-SymbolicName was A.model instead of plain A.
(of course i had to rename all the references to the plugin after that)

Weirdly enough this made no problem at all elswhere

Changing Bundle-SymbolicName:a;singleton:=true fixed it for me.

Hope this may be of help to someone in the future ;)
Previous Topic:Negative values for Enum entries create an warning in the editor.
Next Topic:[Edapt] Migrating cross reference classcast issue
Goto Forum:
  


Current Time: Fri Apr 19 02:39:52 GMT 2024

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

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

Back to the top