Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 319167 - Classcast exception from EnterpriseBeanImpl
Summary: Classcast exception from EnterpriseBeanImpl
Status: RESOLVED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.2.1   Edit
Assignee: Neeraj Agrawal CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard: PMC_approved
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-07 13:32 EDT by Neeraj Agrawal CLA
Modified: 2010-07-08 15:35 EDT (History)
1 user (show)

See Also:
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+


Attachments
Patch (1.15 KB, patch)
2010-07-07 13:35 EDT, Neeraj Agrawal CLA
ccc: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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