A summary of investigation – bug 137822

April 2, 2009

I felt I was lost in the forest of the code when I try to use debug again and again. Anyway I write down I already knew on this blog to give a summary of my job. It may be easier to get a hint from somebody who stands out of the forest.

According to the suggestion from Larry Isaacs’s answer dated on March 16 of newsgroup( http://www.eclipse.org/newsportal/thread.php?group=eclipse.webtools&first=101&last=150 ). I copied the arguments from “Open launch configuration” link to the empty text area of “Run -> Run Configurations -> Apache Tomcat -> New -> Argument”, then click “Apply” button and “Run”, the server can run without any exception. Based on Larry’s suggestion and my investigation, there are four possible solutions about bug 137822:

1. When we new a tomcate server, the system set some default value for Program
and VM at the same time.
2. When we click the dropdown list and select one server, then click button
“apply”, the values are set at that time.
3. The system didn’t set values by using the above ways. When we click button
“run”, if the system can’t get any run time arguments, it just pop-ups a dialog
to say no available server rather than throwing a exception.
4. If the Program and VM arguments are empty, just disable the button “run”.

In order to investigate the bug, I found the related the class and method with the above solutions:
1.
1.1 If “Run -> Run Configurations -> Apache Tomcat” is empty, then the method public void setDefaults(ILaunchConfigurationWorkingCopy configuration) of org.eclipse.wst.server.ui.ServerLaunchConfigurationTab.java will be invoked first.
Those line of code is supposed to get the first server from the server combox and set the default sever; however, at this point, no server is selected and no server configuration is set.
1.2 If “Run -> Run Configurations -> Apache Tomcat” is not empty, when click the a server, then method public void createControl(Composite parent) of org.eclipse.wst.server.ui.ServerLaunchConfigurationTab.java will be invoked. This method will created the server combox of Run configurations.

2. the apply button will invoke the method performApply() which in the package org.eclipse.wst.server.ui.ServerLaunchConfigurationTab.

Based on Larry Isaacs’s suggestion (newsgroup dated on april 4), solution 3 and 4 only hidden the problem. So we should get rid of them.