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

Bug 324020

Summary: Remove unnecessary in J2EEComponentClasspathContainer cast to avoid potential class cast exceptions
Product: [WebTools] WTP Java EE Tools Reporter: Jason Sholl <jsholl>
Component: jst.j2eeAssignee: Jason Sholl <jsholl>
Status: RESOLVED FIXED QA Contact: Chuck Bridgham <cbridgha>
Severity: normal    
Priority: P3 Flags: jsholl: pmc_approved? (david_williams)
jsholl: pmc_approved? (raghunathan.srinivasan)
jsholl: pmc_approved? (naci.dai)
deboer: pmc_approved+
jsholl: pmc_approved? (neil.hauge)
jsholl: pmc_approved? (kaloyan)
cbridgha: review+
Version: 3.2   
Target Milestone: 3.2.2   
Hardware: PC   
OS: Windows Server 2003   
Whiteboard: PMC_approved
Attachments:
Description Flags
patch none

Description Jason Sholl CLA 2010-08-30 15:18:31 EDT
This cast is completely unnecessary and has caused the following exception.  Best to remove it.

Problems occurred when invoking code from plug-in: "org.eclipse.jst.j2ee".
java.lang.ClassCastException: org.eclipse.wst.common.componentcore.internal.resources.VirtualComponent incompatible with org.eclipse.jst.j2ee.componentcore.util.EARVirtualComponent
	at org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainer.getBaseEARLibRefs(Unknown Source)
	at org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainer.requiresUpdate(Unknown Source)
	at org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathContainer.refresh(Unknown Source)
	at org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater$ModuleUpdateJob.processModules(Unknown Source)
	at org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater$ModuleUpdateJob.access$4(Unknown Source)
	at org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater$ModuleUpdateJob$1.run(Unknown Source)
	at org.eclipse.core.runtime.SafeRunner.run(Unknown Source)
	at org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater$ModuleUpdateJob.run(Unknown Source)
	at org.eclipse.core.internal.jobs.Worker.run(Unknown Source)
Comment 1 Jason Sholl CLA 2010-08-30 15:20:12 EDT
Created attachment 177768 [details]
patch
Comment 2 Jason Sholl CLA 2010-08-30 15:21:44 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. 

If this exception occurs the EAR Libraries classpath container could be corrupted.

    * 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? 

Manually

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

There is no reason for this cast.  Jason & Chuck

    * What is the risk associated with this fix? 

None
Comment 3 Chuck Bridgham CLA 2010-08-30 15:27:32 EDT
approved
Comment 4 Jason Sholl CLA 2010-08-30 17:21:09 EDT
code checked into head for 3.2.2 and 3.3