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

Bug 422481

Summary: Add a new preference to consider the target runtime when deciding to check or not 'Add to EAR' by default
Product: [WebTools] WTP Java EE Tools Reporter: Julio C. Chavez <chavezjc>
Component: jst.j2eeAssignee: Julio C. Chavez <chavezjc>
Status: RESOLVED FIXED QA Contact: Chuck Bridgham <cbridgha>
Severity: normal    
Priority: P3 CC: cbridgha, ccc, david_williams, kaloyan, naci.dai, neil.hauge, raghunathan.srinivasan
Version: 3.5.1Flags: chavezjc: kepler+
chavezjc: pmc_approved? (david_williams)
chavezjc: pmc_approved? (raghunathan.srinivasan)
chavezjc: pmc_approved? (naci.dai)
chavezjc: pmc_approved? (neil.hauge)
cbridgha: pmc_approved+
chavezjc: pmc_approved? (kaloyan)
cbridgha: review+
Target Milestone: 3.5.2   
Hardware: All   
OS: All   
Whiteboard: PMC
Bug Depends on: 422173    
Bug Blocks:    
Attachments:
Description Flags
Proposed fix to add the preference and react according to the value found there
none
Patch update with version update
none
Patch update
none
Patch update
none
Patch update none

Description Julio C. Chavez CLA 2013-11-25 10:22:10 EST
+++ This bug was initially created as a clone of Bug #422173, this clon is to deliver the changes to 3.5 stream +++

Currently, the preference [addToEarByDefault] is used to define if the 'Add to EAR' is selected or not, but this does not consider the target runtime configured in the project.

So, a new preference is necessary consider if the target runtime requires or not the EAR for a web project.  
 
It would be necessary to update the DataModel to react properly to this new preference.
Comment 1 Julio C. Chavez CLA 2013-11-25 10:23:20 EST
Created attachment 237692 [details]
Proposed fix to add the preference and react according to the value found there

Proposed fix to add the preference and react according to the value found there

The proposed fix:

- Adds the preference, with the default value (empty), so any adopter can set it at need
- A new private method that verifies the name of the runtime *if any* in the DataModel for the project, if it matches with any in the exclusion list the AddToEAR flag is set to false.
Comment 2 Julio C. Chavez CLA 2013-11-26 16:38:02 EST
Created attachment 237739 [details]
Patch update with version update
Comment 3 Chuck Bridgham CLA 2013-11-26 17:07:12 EST
approved
Comment 4 Julio C. Chavez CLA 2013-11-28 15:34:32 EST
Created attachment 237820 [details]
Patch update
Comment 5 Julio C. Chavez CLA 2013-11-28 15:35:44 EST
By Committer comments the verification was modified to use IRuntimeType instead of IRuntime.
Comment 6 Julio C. Chavez CLA 2013-11-28 15:36:04 EST
Created attachment 237821 [details]
Patch update

By Committer comments the verification was modified to use IRuntimeType instead of IRuntime.
Comment 7 Julio C. Chavez CLA 2013-11-28 15:37:22 EST
Created attachment 237823 [details]
Patch update
Comment 8 Julio C. Chavez CLA 2013-12-04 12:18:46 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. 
An Adopter, IBM, is requesting to backport this functionality to WTP 3.5.2, in order to match the behavior in 3.6.0 and 3.5.2.

- Is there a work-around? If so, why do you believe the work-around is insufficient?

No, there is not a work around. The adopter product requires a preference to indicate which runtimes need will not require as default the ADD_TO_EAR for web projects. 

- How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added?
Tested manually, verifying there is not change in the current behavior; the runtime exception list is empty in WTP, so there shouldn't be any modification there. 

- Give a brief technical overview. Who has reviewed this fix?
A new preference was added, indicating the list of runtimes which ADD_TO_EAR preference should be false for Web projects. So, if the selected runtime matches with one in the list (using the RuntimeType ID), the Add to EAR is false. 
If the list is empty (as it is by default for WTP) there is not change at all in the current behavior.

- What is the risk associated with this fix? 
Low. If there is not a matching runtime (empty list or inexistent one), the result of the verification method is by default true, depending completely of ADD_TO_EAR flag value.
The way modify this, is adding TypeRuntime ID(s) to the list, in this case when the matching runtime is found, the method returns FALSE, making the ADD_TO_EAR flag FALSE. So, the only modification is when an adopter change the new preference. 
This change is being tested and used in 3.6
Comment 9 Carl Anderson CLA 2014-02-05 15:20:22 EST
This was committed to master for M4 and to R3_5_maintenance a while back.