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

Bug 266064

Summary: ClassCastExceptions for EAR with 5.0 facet and 1.4 DD
Product: [WebTools] WTP Java EE Tools Reporter: Carl Anderson <ccc>
Component: jst.j2eeAssignee: Carl Anderson <ccc>
Status: RESOLVED FIXED QA Contact: Chuck Bridgham <cbridgha>
Severity: normal    
Priority: P3 CC: ccc, kaloyan
Version: 3.0.4   
Target Milestone: 3.0.4 P   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 265862    
Bug Blocks:    

Description Carl Anderson CLA 2009-02-24 20:52:51 EST
This clone is created for tracking purposes to get this fix into the 3.0.4 P
stream/build.

+++ This bug was initially created as a clone of Bug #265862 +++

Created an attachment (id=126489)
patch

When importing an EAR that has a facet and component version of 5.0 and a 
DD version of 1.4 I got a classcastexception when the component classpath updater attempted to get the EAR lib directory.  This is because it called JavaEEProjectUtilities.isJEEComponent(IVirtualComponent component) to determine if this was a Java EE 5 EAR.  The problem is that this method used the facet to determine this and returned true.  I created a new utility method called 
JavaEEProjectUtilities.isJEEComponent(IVirtualComponent component, int versionType) that takes a flag (FACET_VERSION or DD_VERSION) to determine whether the facet or the dd should be used to determine the version.  I updated J2EEComponentClasspathContainer.getEARLibDir(x) to call this utility method with a flag of DD_VERSION.

This other classcastexception occurred when the module dependencies page was opened for this EAR project.  When attempting to get the library directory for the EAR in AvailableJ2EEComponentsForEARContentProvider.getElements(x). 
Added a check here to do this only if the DD version was 5.0.
Comment 1 Carl Anderson CLA 2009-02-25 01:57:36 EST
Commited to R3_0_4_patches for WTP 3.0.4P