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:

  1. Identify a unique string in the GUI
  2. Search for the string in the .property files
  3. Identify the key associated to the string
  4. Search for the key in the .java files
  5. 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.

Buzilla Bug Info 241429

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.

Eclipse WTP - Java EE Prespective

Under the “Server” tab right click a server and click on “Properties”.

Eclipse WTP - Server Properties

The Properties window for the server will appear.

Eclipse WTP - Server Properties - Switch Location

The description from Buzilla states, if we click on the “Switch Location” button the UI hangs for a significant period of time.

Eclipse WTP - Server Properties - Switch Location 2

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 Eclipse WTP - Add 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.

Eclipse WTP - Add CVS Repository

  • 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.

Eclipse WTP - wst.server

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”.

Eclipse WTP - Server Properties - Switch Location 1

Now open a search window by clicking on “Search” from the menu bar and selecting “Search” or press “Ctrl + H”.

Eclipse WTP - Search

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.

Eclipse WTP - Search Window 1

From the following search result, double click to open the file where the searched string, “Switch Location”, was found.

Eclipse WTP - Search Result 1

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”.

Eclipse WTP - Messages.properties File

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.

Eclipse WTP - Search Window 2

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.

Eclipse WTP - Search Result 2

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.

Eclipse WTP - Server Property Page

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.

About these ads

3 Responses to “Eclipse WTP: How to Effectively and Efficiently Find a Bug”

  1. Peter Liu said

    Hi, John.

    Excellent and informative posting. Pleas keep on blogging.

    Peter.

  2. Kevin Vu said

    Hi John, nice “how to”! I couldn’t catch up with Angel Very when he demonstrated in class :D.

  3. heyqule said

    Hey John

    Excellent walkthrough.. lol… what else did angel talk about?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: