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

Bug 346888

Summary: NPE in ReflectiveItemProvider
Product: [Modeling] EMF Reporter: Mathieu Velten <mathieu.velten>
Component: EditAssignee: Ed Merks <Ed.Merks>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 2.7.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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.