Stack Traces for Bug 244862 – WTP

April 12, 2009

After I recieved the email from Peter Liu who mentioned Tahereh’s working bug 244862, I take a quick look. I followed Davoud’s introduction to reproduce it. I catch several stack traces for the bug 244862 in different scenarios even though I don’t what we can do to fix the bug. Anyway I posted them so that other students may get some hints from the stack traces.

Stack Trace for creating a server

Stack trace for creating a server

Stack trace for creating a server

Stack Trace for Starting a server without any Started server

Stack stack for starting a server when there no started server

Stack stack for starting a server when there no started server

Stack Trace for Starting a Server with a Started Server

Stack Trace for starting server, publishing the server is failed

Stack Trace for starting server, publishing the server is failed

Stack Trace for Deleting Server Project from Package Explore

Delete the server project from package explore

Delete the server project from package explore

Stack Trace for Deleting Server from Server View
bug244862_deleteserver3


How does “Run as->Run configurations” work

April 6, 2009

As I tried to investigate the bug 137822 which is related to the server configuration, I got some idea about how the server configuration works. Anyway I posted some of my findings so that some other students may get some help from my findings to fix some other server related bugs (there are still some server-related bugs need to be fixed in the bug list.).

After Clicking the “Run -> Run Configurations”, the following steps are invoked:

  1. The configuration dialog is opened
  2. The content of the configuration dialog is created and filled with all the controls and actions .

    • Create the Viewer area with the event control and action
    • Create the Edit area with the event control, created the tab, filled the server combo from the tomcat server list in the server view
    • Initialize the values including the arguments in the tabs
    • Display the Run Configurations Dialog and be ready to catch any event including mouse and key activities
  3. Catch the Double Click event/ New_configuration action/Selected Item Change event, fire the actions
  4. Create instances including wc with a unique name such as “New configuration(1)”, configuration dialog and the group tabs, initialize the tab content.
  5. write the new configuration information to a file and update launch manager with the new configuration.
  6. Display the updated configuration dialog

Bug 137822 is fixed :)

April 4, 2009

It’s very happy to know that my fellow Le fixed the bug 137822 based on my posting. see Le’s post.

Anyway, I list some important classes and methods which related to the bug and web server. Some other person who worked on the web server tool may get some help or hint from my investigation.

  1. org.eclipse.debug.internal.ui.launchConfigurations is a important package in the plugin.

    • CreateLaunchConfigurationAction.performAction() — create wc with the unique name “New_Configuration(1)”,configuration dialog with all the tabs, set the default configuration for the dialog to be the new created wc .
    • LaunchConfigurationView.handleConfigurationAdded()
    • createLaunchConfigurationSelectionArea()
      (handler double click, display a tree of launch configurations that may select, and allow to create new configurations and delete, duplicate existing configuration)
    • LaunchConfigurationTabGroupViewer — create a viewer to display tabs for a launch configuration with Apply and Revert button.
    • LaunchConfigurationDialog (line 423(create),1055(open))
      create the launch configuration dialog
    • LaunchConfigurationTabGroupViewer.inputChanged
    • .LaunchConfigurationDialog (line 543) — catch selectionEvent, then call handleConfigurationAdded()
  2. org.eclipse.wst.server.ui.ServerLaunchConfigurationTab.performApply()
    (will get the server configuration “Tomcat 6.0”)
  3. org.eclipse.wst.server.core.internal.Server.getLaunchConfiguration(bool,IProgress) — bool is true, will create a new server.
  4. org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour.
    setLaunchConfiguration ILaunchConfigurationWorkingCopy workingCopy, IProgressMonitor monitor) (set the tomcat arguments for the VM and Program)
  5. org.eclipse.debug.internal.core.LaunchManager.run() — catch Add, then launch fListener.launchConfigurationAdded(fConfiguration)
  6. org.eclipse.swt.Display.runDerredEvents() –Always called by Display to get any event including selection, mousedown etc.
  7. org.eclipse.jface.util.OpenStrategy.handlerEvent — catch all the event, mouseup,mousedown, etc. then call function
    . Keydown may invoke fireOpenEvent(new SelectionEvent(e))
    .Selection may invoke fireSelectionEvent(event); then may invoke firePostSelectionEvent(new SelectionEvent(e))

A little progress – bug 137822

April 3, 2009

Today I add following code to the line 132 of org.eclipse..server.ui.ServerLaunchConfigurationTab(), then I am able to get the arguments and run the server without exception.

try{
server2.getLaunchConfiguration(true, null);
}catch(Exception ex){}

However, there are two Apach Servers created when I click the new once.
bug137822-two-servers1

Because a new server instance will be created by using the name “Tomcat v6.0 Server at localhost” in the method server.getLauchConfiguration(true,null). So there is a problem to use server.getLauchConfiguration(true,null) to get the configuration.


two ways to get stack trace — WTP

March 31, 2009

Ways to get the stack trace:
1. Set some break points on the source code. run it in debug mode. Once the break point was hit, right click Thread then click copy stack, then paste on any editor (such as notepad);
2. If there are some exception when running WTP, then go to Window-> Show View -> Other -> General -> Error log, then go the Error log view and double click any the error.


The package which I checked out-bug137822

March 27, 2009

I checked out several packages for bug 137822:

org.eclipse.jst.server.tomcat.core,
org.eclipse.wst.server.core,
org.eclipse.wst.server.ui

I think it’s a good start to reproduce them and take a look my stack trace first. I hope we can fix this bug together.


WTP-bug 137822 Get the execution path

March 25, 2009

Two different execution paths by running the server in two different ways

=========
From previous comments, we know that the program is executed in two different way for step 1 and step 2, so that the arguments for the Program and VM are set in two different ways. The arguments for Program and VM in step 2 are set properly; however The arguments for Program and VM in step 1 are not set at all. As Tim deBoer said that somewhere the program should call the method setupLaunchConfiguration() to set the arguments. In order to get the execute path by looking at the exception stack Trace I do following things:

1. Created an exception (int i = Integer.parseInt(“my exception”);)
2. Add this exception code in the line 226 of  org.eclipse.wst.server.ui.ServerLaunchConfigurationTab.setDefaults(ILaunchConfigurationWorkingCopy) for step 1;
3. Run the server by Click/Run as –> Run Configuration, then check the Error Log and get the Exception Stack Trace:
Bug 137822 exception stack
bug137822_exception
4. Add this exception code in the line 771 of org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour.setupLaunchConfiguration(ILaunchConfigurationWorkingCopy, IProgressMonitor) for step 2
5. Open the server configuration dialog from the server view and click the link “Open launch configuration” , then check the Error Log and get the Exception Stack Trace:
Bug 137822 regular stack
bug137822_regular

By looking at the stack trace, I found some code in org.eclipse.wst.server.ui.ServerLaunchConfigurationTab.setDefaults() such as :
line 217: if (servers != null) {
server = servers.get(serverCombo.getSelectionIndex());
if (server != null)
((Server) server).setupLaunchConfiguration(configuration, null);
However, the server is null and the configuration is null, that’s why it’s impossible to set the LaunchConfiguration stuff.

As we can see, the rest methods in the stack are in a jar file, and I can make any change in the jar file code. Someone knows how to add some code in a jar file?