Eclipse WTP: How to Effectively and Efficiently Find a Bug
February 20, 2009
Angel Vera is an Eclipse WTP Project Team Committer who has been working for IBM since 2000. He started as a level 2 – 3 support staff where he closely worked with end users to understand the specifics of where bugs originate. Later he transited into a developer position working with the DB2 environment and from there, he found his interest in server tools which lead him to become an Eclipse WTP Project Team Committer with advance knowledge in server tools.
I would like to take this moment to thank Angel Vera for taking time from his busy schedule to come to Seneca College and present his views on “How to effectively and efficiently find a bug“.
In summary there are five important parts to finding a bug:
- Identify a unique string in the GUI
- Search for the string in the .property files
- Identify the key associated to the string
- Search for the key in the .java files
- Identify the code that is causing the bug
Now lets walk through the example that Angel had presented to us. Bug 241429
First, read about the bug on Bugzilla then read it again, including the comments.
Once you finished reading about the bug, identify the Component and Version of the bug. As seen in the above image, the “Component” and “Version” information about the bug is circled in red. In this example, the component of the bug exist in the “wst.server” package identified in version 3.0 of the WTP plaftform.
Now launch your WTP platform, preferably version 3.0. I do not have version 3.0 and so I will use version 3.1M4 and we will see if this bug still exist.
To reproduce bug 241429 from this example, we will need to open a “Java EE” perspective.
Under the “Server” tab right click a server and click on “Properties”.
The Properties window for the server will appear.
The description from Buzilla states, if we click on the “Switch Location” button the UI hangs for a significant period of time.
When we clicked on the “Switch Location” button, the “Location” changed to “[workspace metadata]” and the UI didn”t seem to hang at all. It appears this bug no longer exist in this version (3.1M4).
However, for the sake of continuing this article we will assume the bug exist. Now lets find the code!!
In your WTP platform, open a “CVS Repository Exploring” perspective to connect to the “dev.eclipse.org” “cvsroot/webtools” repository.
If you have not added this repository to your list of “CVS Repositories” then click on the add a CVS Repository button to add a new CVS Repository. Once you click on this button the below window will appear. Fill in the “Host” and the “Repository path” as seen in the below image and select “anonymous” as the “User”. As for the password, fill in your email address then click on the “finish” button.
- Host: dev.eclipse.org
- Repository path: /cvsroot/webtools
- User: anonymous
- Password: <your email address>
Now its time to check out the packages we may need in order to find our bug.
Perviously from Bugzilla, we identified the “Component” for this bug (wst.server). Now, check out all packages within this package.
From the Server Properties window in our Java EE perspective, identify a unique string in the GUI. We will use the string from the button “Switch Location”.
Now open a search window by clicking on “Search” from the menu bar and selecting “Search” or press “Ctrl + H”.
The Search window will appear. Enter “Switch Location” into the “Containing text:” field and enter “*.properties” into the “File name patterns:” field, then click on the “Search” button.
From the following search result, double click to open the file where the searched string, “Switch Location”, was found.
Find the line where the searched string, “Switch Location”, is located and identify the key associated to that string. In this example it is “actionSwitchServerLocation”.
Now reopen the search window “Ctrl + H” and enter “actionSwitchServerLocation” into the “Containing text:” field and enter “*.java” into the “File name patterns:” field, then click on the “Search” button.
From the following search result, double click to open the files where the searched string “actionSwitchServerLocation” was found and analyze the files to see which code is causing the bug.
From this example, the Messages.java file contains the declaration of the static variable and the ServerPropertyPage.java contains code where the variable is set and used.
If there was a bug in the code the ServerPropertyPage.java would be the place to find the bug. However, in this case there was no bug.