Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 509571 - NPE when calling method GenTypenmodel invalid without ecoreFeaturedElementImpl.isListType() on a ge
Summary: NPE when calling method GenTypenmodel invalid without ecoreFeaturedElementImp...
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: Core (show other bugs)
Version: 4.6   Edit
Hardware: PC Windows NT
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Ed Merks CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-21 05:52 EST by Pierre Guilet CLA
Modified: 2017-08-14 07:18 EDT (History)
0 users

See Also:


Attachments
Test to reproduce (24.97 KB, application/x-zip)
2016-12-21 05:52 EST, Pierre Guilet CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre Guilet CLA 2016-12-21 05:52:01 EST
Created attachment 266004 [details]
Test to reproduce

For some reasons, the genmodel can be unsynchronized with the ecore and can have a GenFeature without EcoreFeature.

In this situation that we add for a Sirius user : https://bugs.eclipse.org/bugs/show_bug.cgi?id=509565

an NPE is thrown if we do a call of the method org.eclipse.emf.codegen.ecore.genmodel.impl.GenClassImpl.getLabelFeature() in the sub method org.eclipse.emf.codegen.ecore.genmodel.impl.GenTypedElementImpl.isListType() in the return because the eTypedElement is null.

A null check at this point would avoid the NPE and the impact it can have with Sirius integration.

I attached a basic project for reproduction.
To reproduce :
- Run application mymy.TestClass.main(String[])
Comment 1 Pierre Guilet CLA 2016-12-21 10:20:55 EST
The same problem is also present for org.eclipse.emf.codegen.ecore.genmodel.impl.GenFeatureImpl.getName() where we do the getEcoreFeature().getName() without null check
Comment 2 Pierre Guilet CLA 2016-12-21 10:31:48 EST
(In reply to Pierre Guilet from comment #1)
> The same problem is also present for
> org.eclipse.emf.codegen.ecore.genmodel.impl.GenFeatureImpl.getName() where
> we do the getEcoreFeature().getName() without null check

Don't mind this comment it has been fixed in master
Comment 3 Eclipse Genie CLA 2016-12-21 10:40:38 EST
New Gerrit change created: https://git.eclipse.org/r/87571
Comment 4 Ed Merks CLA 2017-01-05 08:17:51 EST
The equivalent fix is committed to master:

http://git.eclipse.org/c/emf/org.eclipse.emf.git/commit/?id=73b39ab6bcb3ed81e68973d9de415206a563c315
Comment 5 Ed Merks CLA 2017-08-14 07:18:19 EDT
The fixes are all the 2.13 release in Oxygen.