Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346888 - NPE in ReflectiveItemProvider
Summary: NPE in ReflectiveItemProvider
Status: RESOLVED WONTFIX
Alias: None
Product: EMF
Classification: Modeling
Component: Edit (show other bugs)
Version: 2.7.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ed Merks CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-23 12:15 EDT by Mathieu Velten CLA
Modified: 2011-05-23 12:24 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 Mathieu Velten CLA 2011-05-23 12:15:14 EDT
An NPE is triggered when an attribute without a type is encountered :
according to the ecore meta model an attribute without a type should be valid (0..1).

stacktrace :
java.lang.NullPointerException
	at org.eclipse.emf.edit.provider.ReflectiveItemProvider.getChildrenFeatures(ReflectiveItemProvider.java:309)
	at org.eclipse.emf.edit.provider.ItemProviderAdapter.getAnyChildrenFeatures(ItemProviderAdapter.java:459)
	at org.eclipse.emf.edit.provider.ItemProviderAdapter.isWrappingNeeded(ItemProviderAdapter.java:2003)
	at org.eclipse.emf.edit.provider.ReflectiveItemProvider.isWrappingNeeded(ReflectiveItemProvider.java:750)
	at org.eclipse.emf.edit.provider.ItemProviderAdapter.createChildrenStore(ItemProviderAdapter.java:2031)
	at org.eclipse.emf.edit.provider.ItemProviderAdapter.getChildren(ItemProviderAdapter.java:330)
	at org.eclipse.uml2.uml.edit.providers.ElementItemProvider.getChildren(ElementItemProvider.java:347)
	at org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider.getChildren(AdapterFactoryContentProvider.java:179)
Comment 1 Mathieu Velten CLA 2011-05-23 12:19:01 EDT
There are other unsafe getEType() in this class on line 89, 357 and 736.
Comment 2 Ed Merks CLA 2011-05-23 12:20:44 EDT
This code assumes well formed Ecore models.  We won't change it to work with models that don't validate.  

While an EOperation doesn't require an eType, because no type represents void, structured features must have a type, i.e., EAttribute.eAttributeType is required, and it's derived from eType.
Comment 3 Mathieu Velten CLA 2011-05-23 12:24:17 EDT
OK thanks, I didn't thought about the mandatory derived feature.