Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311981 - Adding user library to project other than web and EAR creates cycle dependency
Summary: Adding user library to project other than web and EAR creates cycle dependency
Status: RESOLVED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 RC1   Edit
Assignee: Jason Sholl CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard: PMC_approved
Keywords:
: 311993 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-05-06 17:26 EDT by Jason Sholl CLA
Modified: 2010-05-13 23:13 EDT (History)
1 user (show)

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


Attachments
patch (8.24 KB, patch)
2010-05-06 17:28 EDT, Jason Sholl CLA
no flags Details | Diff
patch (8.26 KB, patch)
2010-05-07 10:46 EDT, Jason Sholl CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Sholl CLA 2010-05-06 17:26:46 EDT
I added a user library to a connector project and the EAR libraries container shows that it added itself and I see JDT cycle dependency errors.

The problem is that this library reference is consumed (as opposed to used).  A check is necessary in J2EEComponentClasspathContainer to ensure consumed type references are not added directly to the classpath (because these references will always point back to the same project rather than the resolved contents).

While I was testing this with some elaborate assembly scenarios, I noticed some NPEs coming from the RemoveComponentFromEnterpriseApplicaitonOperation code; that's what the change in there is for.  While I was investigating that, I steped into the getModuleURI() method a few lines up and discovered the reason this module wasn't being found was because there was no equals or hashcode defined for ClasspathContainerVirtualComponent or its super class; so I created those, and also filtered out the consumed references from this list anyways.

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

Without this fix there will be cyclicial classpaths, and NPEs

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

Tested with UI; no JUnit

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

see above.  Chuck and Jason have reviewed

    * What is the risk associated with this fix? 

minimal
Comment 1 Jason Sholl CLA 2010-05-06 17:28:01 EDT
Created attachment 167405 [details]
patch
Comment 2 Jason Sholl CLA 2010-05-07 10:46:40 EDT
Created attachment 167486 [details]
patch

Updated to remove NPE risk in component equals() methods
Comment 3 Chuck Bridgham CLA 2010-05-07 15:13:43 EDT
approve
Comment 4 Jason Sholl CLA 2010-05-10 09:58:44 EDT
*** Bug 311993 has been marked as a duplicate of this bug. ***
Comment 5 Jason Sholl CLA 2010-05-10 13:44:55 EDT
code checked in for RC1