Eclipse WTP – Locating The Code

I’m very glad that I’ve reached The Fourth Milestone set up by Jordan. Bug 256185 is about NullPointerException. Here are the steps that I took to locate the code that throws this exception.

1. A stack trace from the JVM was attached to the Bug Report. This gave me a very good starting point. I checked out the org.eclipse.wst.wsdl.ui component from the CVS repository. (Although I did set the Plug In Development Target Platform correctly, I got error messages from the compiler on the development platform. After inspecting the error messages, I also checked out the org.eclipse.wst.wsdl component. All the error messages then disappeared. This second component was not related to the bug, however.)

2. Following the stack trace, I tinkered with the class. I added a comment and inserted one System.out.prinltn statement. When I tried to run this class with the target platform, I encountered a strange problem – the WSDL editor was not invoked at all. I posted my problem and some screenshots to the webtools newsgroup. With Valentin’s advice, I found out that it was indeed caused by inconsistent versions between the source code(checked out from HEAD) and the target platform(3.1M4 build). Thus I downloaded and installed the 3.1M5 build that was released in early February. Everything was running smoothly since then.

3. Following the stack trace again, I inserted a few System.out.println statements in two methods, namley dropDown and popupEvent. I found it interesting to see some output displayed in the console view on the development platform. Then I realized that I could not use the line numbers in the stack trace since I had added some comments and statements to those methods. I felt a kind of stupid. Now I had to find a way to get an updated stack trace on the basis of the class that I had modified. I posted my question to the Bug Report. Valentin showed me how to access the stack trace on the target platform. It’s a very useful technique.

4. I ran the ASDCCombo class with the target platform again. Then I reproduced the bug on the target platform instance. Following Valentin’s advice, I went through this sequence of selections: Window > Show View > Other > Erro Log. I saw the stack trace in the Event Details dialog box. This time I used the line number in the stack trace to locate the code on the development platform. In order to confirm that this was the line of code that threw the NullPointerException, I inserted a line of code:
System.out.println( “oh boy – text is null” ). I ran the class again. The output in the console view on the development platform was consistent with the stack trace (the Error Log) displayed on the target platform.

From hindsight, I could have located the code quite quickly if I did not tinker with the source code I checked out from the CVS repository. I was very near to finding the code when I had the stack trace on hand. However, I didn’t regret from “playing with the code.” I have acquired some knowledge regarding the inner workings of the WTP platforms. I have also found Valentin to be very supportive when I posted my questions at the webtools newsgroup and Bugzilla(i.e. the Bug Report). Finally I was amazed by Tony Lai’s comment to my blog posting. He’s working on a Mozilla project and has used exceptions to track down a bug. Last but not the least, after going around the circle, I’ve built up my confidence in fixing WTP bugs.

Here are three screenshots:

1. the stack trace

2. the  event details dialog box

3. the console view



5 Responses to “Eclipse WTP – Locating The Code”

  1. Jordan Says:


    I found your post exceptional well done. This is a type of work we all should be doing in trying to find the bug fix.
    Thank you for your outstanding contribution to our endeavor.


  2. Davoud Says:


    I would like to thank you too for your posts on your experiences. Hopefully I’ll be able to use some of what you have experiened and how you have handled the case with null pointer exception error for the bug I have picked.

    Thanks for your contributions.


  3. nkhan26 Says:

    Thank you for sharing your findings. You have been very helpful.


  4. shelleyshi Says:

    Hi Peter,

    After I read you blog, I found I made a circle as you did before. Thanks for your contribution. I really need spent more time on reading related blogs before I try to do anything.


  5. Peter Liu Says:

    Hi, Shelley.

    I’m glad it was helpful to you. Please share your experiences when you
    give your presentation.


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: