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

Bug 351899

Summary: action properties passed to RunOnServerAction can be ignored
Product: [WebTools] WTP ServerTools Reporter: Ian Tewksbury <itewksbu>
Component: wst.serverAssignee: Steven Hung <sghung>
Status: RESOLVED FIXED QA Contact: Elson Yuen <eyuen7>
Severity: normal    
Priority: P3 CC: eyuen7
Version: 3.2   
Target Milestone: 3.2.5 P   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/109094
Whiteboard:
Bug Depends on:    
Bug Blocks: 373447    
Attachments:
Description Flags
Patch v1.0 eyuen7: iplog+

Description Ian Tewksbury CLA 2011-07-12 16:41:42 EDT
Bug 337210 added the functionality to be able to pass action properties to the RunOnServerAction.  The problem is if the user checks the button to "always use this server" in the Run On Server wizard then for future on on server action runs the passed action properties are ignored.
Comment 1 Steven Hung CLA 2012-01-28 11:40:23 EST
Created attachment 210232 [details]
Patch v1.0

Overview of Fix:
In org.eclipse.wst.server.ui.internal.actions.RunOnServerActionDelegate.run(), the client and launchableAdapter are set with predefined values via getOverwriteValue if they exist. If they do not exist, these values are null. 

In the case where these values are non-null, and the RunOnServerWizard is shown when calling org.eclipse.wst.server.ui.internal.actions.RunOnServerActionDelegate.getServer(IModule, IModuleArtifact, IProgressMonitor), the client and launchableAdapter will NOT have its values set based on the values from the wizard.

In the case where these values are null, and the RunOnServerWizard is shown when calling org.eclipse.wst.server.ui.internal.actions.RunOnServerActionDelegate.getServer(IModule, IModuleArtifact, IProgressMonitor), the client and launchableAdapter will have its values set based on the values from the wizard because they are null.

In the case where the RunOnServerWiard is not shown (i.e. "Always Use this Server" was enabled), the behaviour of setting the client and launchableAdapter only if they are null needs to be preserved. Prior to this patch, it was incorrectly overwriting the predefined values without doing any checks. As a result, the action properties were being ignored.

In addition to fixing the overwriting issue, I have also added trace strings to help diagnose this issue.

Tests Run:
Tomcat + Using "Run on Server", which does not set predefined values for client or launchableAdapter
1. "Always Use this Server" disabled, verified that Run on Server wizard is shown, and webpage is shown correctly
2. "Always Use this Server" enabled, verified that Run on Server wizard is not shown, and webpage is shown correctly

Server Adapter + Using a launch type which does set predefined values for client and launchableAdapter and the wizard's values will be null
1. "Always Use this Server" disabled, verified that Run on Server wizard is shown, and webpage is shown correctly
2. "Always Use this Server" enabled, verified that Run on Server wizard is not shown, and webpage is shown correctly (this was the reported issue where the action properties were ignored)
Comment 2 Elson Yuen CLA 2012-02-01 16:21:14 EST
The patch looks good to me. Thanks for submitting the patch.
Comment 3 Elson Yuen CLA 2012-02-07 10:57:13 EST
Changes released to HEAD
Comment 4 Ian Tewksbury CLA 2012-02-07 11:08:46 EST
Thanks.  What about 3.2.5 P?
Comment 5 Elson Yuen CLA 2012-02-09 18:20:29 EST
Code released to 325P
Comment 6 Ian Tewksbury CLA 2012-02-10 16:17:00 EST
Awesome, thanks!
Comment 7 Eclipse Genie CLA 2017-10-11 16:37:56 EDT
New Gerrit change created: https://git.eclipse.org/r/109094