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

Bug 316475

Summary: NPE in EMF2DOMAdapterImpl
Product: [WebTools] WTP Common Tools Reporter: Dimitar Giormov <dimitar.giormov>
Component: wst.commonAssignee: Roberto Sanchez Herrera <shr31223>
Status: RESOLVED INVALID QA Contact: Carl Anderson <ccc>
Severity: normal    
Priority: P2 CC: Dimo.Stoilov, kaloyan
Version: 3.2   
Target Milestone: 3.2.3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
junit test
none
NPE stacktrace. none

Description Dimitar Giormov CLA 2010-06-10 10:55:03 EDT
We are testing our functionality on Helios, and a NPE showed up in EMF2DOMAdapterImpl.
I have managed to create a junit test for it.
Note that there are 2 test classes one is trying to modify the emf model directly and it passes. The other one creates Ejb Project and a method permission artifact. Adds and removes a security role from it. During removal the attached NPE is thrown.

I will attach the junit as well.
Comment 1 Dimitar Giormov CLA 2010-06-10 10:55:28 EDT
Created attachment 171643 [details]
junit test
Comment 2 Dimitar Giormov CLA 2010-06-10 10:56:24 EDT
Created attachment 171644 [details]
NPE stacktrace.
Comment 3 Carl Anderson CLA 2010-06-10 16:36:59 EDT
Assigning to Chuck for initial investigation.  Looks like the SecurityRole wouldn't have an Adapter, so adapter.getNode() would cause an NPE.
Comment 4 Kaloyan Raev CLA 2010-06-23 04:08:26 EDT
Raising priority. This bug causes a set of our adopter unit test to fail.
Comment 5 Dimo Stoilov CLA 2011-01-21 11:17:39 EST
It turns out the test is not quite correct. It creates security roles but doesn't attach them to the ejb assembly descriptor. 
After correcting this by adding the following line right after roles creation:
methodPerm.getAssemblyDescriptor().getSecurityRoles().add(roles[i]); 
then the test passed.
Comment 6 Dimitar Giormov CLA 2011-01-21 11:33:04 EST
Roberto you can close the bug report.
Comment 7 Roberto Sanchez Herrera CLA 2011-01-21 11:35:34 EST
Resolving this defect based on comment 5 and comment 6. Thank you.