Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339339 - NPE when unloading resources of models which use MinimalEObjectImpl and ExtendedResourceAdapter
Summary: NPE when unloading resources of models which use MinimalEObjectImpl and Exten...
Status: CLOSED FIXED
Alias: None
Product: Sphinx
Classification: Automotive
Component: Core (show other bugs)
Version: 0.7.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 0.7.0   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-09 07:10 EST by Stephan Eberle CLA
Modified: 2021-07-14 02:16 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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