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

Bug 319167

Summary: Classcast exception from EnterpriseBeanImpl
Product: [WebTools] WTP Java EE Tools Reporter: Neeraj Agrawal <nagrawal>
Component: jst.j2eeAssignee: Neeraj Agrawal <nagrawal>
Status: RESOLVED FIXED QA Contact: Chuck Bridgham <cbridgha>
Severity: normal    
Priority: P3 CC: ccc
Version: unspecifiedFlags: nagrawal: pmc_approved? (david_williams)
nagrawal: pmc_approved? (raghunathan.srinivasan)
nagrawal: pmc_approved? (naci.dai)
deboer: pmc_approved+
nagrawal: pmc_approved? (neil.hauge)
nagrawal: pmc_approved? (kaloyan)
cbridgha: review+
Target Milestone: 3.2.1   
Hardware: PC   
OS: Windows 7   
Whiteboard: PMC_approved
Attachments:
Description Flags
Patch ccc: iplog+

Description Neeraj Agrawal CLA 2010-07-07 13:32:13 EDT
Build Identifier: 3.2

In an adopter product following exception is thrown in cases when the name of  EJb class contains invaild value.


    at org.eclipse.jst.j2ee.ejb.internal.impl.EnterpriseBeanImpl.getEjbClass(EnterpriseBeanImpl.java:791)

        at org.eclipse.jst.j2ee.ejb.internal.impl.EnterpriseBeanImpl.eGet(EnterpriseBeanImpl.java:1088)

        at org.eclipse.jst.j2ee.ejb.internal.impl.SessionImpl.eGet(SessionImpl.java:248)

        at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1012)

        at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1004)

        at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:999)

        at org.eclipse.wst.common.internal.emf.resource.Translator.getMOFValue(Translator.java:601)

        at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterImpl.primUpdateMOFFeature(EMF2DOMAdapterImpl.java:1409)

        at org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapterImpl.updateMOFFeature(EMF2DOMAdapterImpl.java:1775)

        at org.eclipse.wst.xml.core.internal.emf2xml.EMF2DOMSSEAdapter.notifyChanged(EMF2DOMSSEAdapter.java:222)

        at org.eclipse.wst.sse.core.internal.provisional.AbstractNotifier.notify(AbstractNotifier.java:201)

Reproducible: Always
Comment 1 Neeraj Agrawal CLA 2010-07-07 13:35:59 EDT
Created attachment 173683 [details]
Patch

The problem can be fixed by simply returning null  from a method in JavaClassTranslator. This is the class which reflects the class based on a given name. The null value for the JavaClass is handled in upsteam chain
Comment 2 Chuck Bridgham CLA 2010-07-07 13:38:16 EDT
approved
Comment 3 Neeraj Agrawal CLA 2010-07-07 14:00:43 EDT
* Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such. 

Requesting approval since the code is not handling the invalid case and the error thrown conveys no meaningful information to the users of the product.


* Is there a work-around? If so, why do you believe the work-around is insufficient?  No

* How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? 

By running editing scenarios of ejb-jar.xml


* Give a brief technical overview. Who has reviewed this fix? 

JavaClassTranslator reflects the class based on user input 
name. When the value is invalid such as  . , ?  the class is not reflected/loaded properly and not so user friendly message and exception is logged. 

Chuck Bridgham has reviewed the fix.

* What is the risk associated with this fix? 
The  fix is safe since it catches the thrown exception and return null which is handled properly in upstream stack.
Comment 4 Carl Anderson CLA 2010-07-07 18:40:03 EDT
Committed to HEAD for WTP 3.2.1 and WTP 3.3