Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 339339

Summary: NPE when unloading resources of models which use MinimalEObjectImpl and ExtendedResourceAdapter
Product: [Automotive] Sphinx Reporter: Stephan Eberle <stephaneberle9>
Component: CoreAssignee: Project Inbox <sphinx-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 0.7.0   
Target Milestone: 0.7.0   
Hardware: All   
OS: All   
Whiteboard:

Description Stephan Eberle CLA 2011-03-09 07:10:43 EST
java.lang.NullPointerException
    at
org.eclipse.emf.ecore.impl.MinimalEObjectImpl.addField(MinimalEObjectImpl.java:412)
    at
org.eclipse.emf.ecore.impl.MinimalEObjectImpl.setField(MinimalEObjectImpl.java:344)
    at
org.eclipse.emf.ecore.impl.MinimalEObjectImpl.eSetProxyURI(MinimalEObjectImpl.java:642)
    at
org.eclipse.sphinx.emf.resource.ExtendedResourceAdapter.unloaded(ExtendedResourceAdapter.java:123)
    at
org.eclipse.sphinx.examples.hummingbird20.util.Hummingbird20ResourceImpl.unloaded(Hummingbird20ResourceImpl.java:72)
    at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.doUnload(ResourceImpl.java:1624)
    at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doUnload(XMLResourceImpl.java:506)
    at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.unload(ResourceImpl.java:1639)
    at
org.eclipse.sphinx.emf.util.EcoreResourceUtil.unloadResource(EcoreResourceUtil.java:913)
    at
org.eclipse.sphinx.emf.util.EcorePlatformUtil$27.run(EcorePlatformUtil.java:1973)
    at
org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
    at
org.eclipse.sphinx.emf.util.EcorePlatformUtil.unloadResources(EcorePlatformUtil.java:1965)
    at
org.eclipse.sphinx.emf.workspace.loading.ModelLoadManager.runUnloadModelResources(ModelLoadManager.java:1023)
    at
org.eclipse.sphinx.emf.workspace.loading.ModelLoadManager.access$4(ModelLoadManager.java:1013)
    at
org.eclipse.sphinx.emf.workspace.loading.ModelLoadManager$5.run(ModelLoadManager.java:990)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
    
The cause is in org.eclipse.sphinx.emf.resource.ExtendedResourceAdapter#unloaded(EObject), line 114, where the fields are cleared by reflection.
Comment 1 Stephan Eberle CLA 2011-03-09 07:21:19 EST
Fixed by excluding MinimalEObject#eFlags and #eStorage fields from reflective nullification. This makes sure that "cleared" MinimalEObjects can still be converted to proxies and identified as such.
Comment 2 Balazs Grill CLA 2021-07-14 02:16:42 EDT
Mass-closing Resolved tickets