Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 370780 - Utility and web fragment modules are imported with latest version of Java facet, and not with the latest version supported by runtime
Summary: Utility and web fragment modules are imported with latest version of Java fac...
Status: RESOLVED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: 3.2.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3.2   Edit
Assignee: Roberto Sanchez Herrera CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard: PMC_Approved
Keywords:
Depends on:
Blocks: 370857
  Show dependency tree
 
Reported: 2012-02-06 17:56 EST by Roberto Sanchez Herrera CLA
Modified: 2012-02-08 15:18 EST (History)
4 users (show)

See Also:
shr31223: pmc_approved? (david_williams)
raghunathan.srinivasan: pmc_approved+
shr31223: pmc_approved? (naci.dai)
shr31223: pmc_approved? (deboer)
shr31223: pmc_approved? (neil.hauge)
kaloyan: pmc_approved+
shr31223: pmc_approved? (cbridgha)
cbridgha: review+


Attachments
Proposed patch (10.03 KB, patch)
2012-02-06 18:37 EST, Roberto Sanchez Herrera CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Roberto Sanchez Herrera CLA 2012-02-06 17:56:45 EST
When a Web, EJB or other modules are imported, the version of the java facet is set to the latest version supported by the target runtime (if a runtime is selected), or to the version appropriate to the Java EE level of the module. But this does not happen for utility or web fragment modules: for those modules, the java facet is always the latest available, which can create a mismatch, for example, if the latest version available for Java is version 1.7, but the target runtime supports up to Java 1.6
Comment 1 Roberto Sanchez Herrera CLA 2012-02-06 18:37:52 EST
Created attachment 210624 [details]
Proposed patch

This patch was created using R3_3_maintenance. The fix consists on re-calculating the java facet version for Utility and Web fragments, in the same way it is done for other modules. I also found an error in JavaEEQuickPeek, which is corrected in this patch.
Comment 2 Chuck Bridgham CLA 2012-02-07 13:59:28 EST
approved.    please add the PMC text/ questions
Comment 3 Roberto Sanchez Herrera CLA 2012-02-07 16:34:51 EST
    * 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. 
This bug can cause utility and web fragment projects to be imported with java facets which are not supported by a target runtime.If the EAR has a combination of Utility, Web, web fragment and ejb modules, when the EAR is imported, the utility and web fragment modules will have different java version than the other modules. Looks like this behavior has been there for a while, but now with Java 7, this problem is more evident.


    * Is there a work-around? If so, why do you believe the work-around is insufficient? 
After importing an EAR that has a combination of Utility, Web, web fragment and ejb modules, if the target server does not support Java 7, the user would have to change the java facet of utility and web fragments projects manually, and assign the target runtime manually.

    * How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? 
Existing JUnits were run. Tested manually.

    * Give a brief technical overview. Who has reviewed this fix? 
The model providers for importing utility and web fragment projects were changed to update the java facet based on the target runtime, or the Java EE spec level, similar to other modules like web and ejb. Chuck Bridgham reviewed the fix.

    * What is the risk associated with this fix? 
Low
Comment 4 Roberto Sanchez Herrera CLA 2012-02-08 15:18:27 EST
Code committed to R3_3_maintenance and HEAD for WTP 3.3.2 and 3.4. Resolving bug.