Archive for February, 2009

Eclipse WTP – Locating The Code

February 22, 2009

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 org.eclipse.wst.wsdl.ui.internal.asd.design.directededit.ASDCCombo 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

Advertisements

Eclipse WTP – Try, Try, Try and Nothing Else

February 18, 2009

On Tuesday(2/17) Angel Vera from IBM came to our class as a guest speaker. He showed us how to use the “Search” feature on the Plug In development platform to locate the fragment of code that was manifesting the behaviour of a bug. His search strategy was as important as the “Search” capability given by the IDE. He picked a word from the GUI that was under investigation. Then he searched through the properties files that have to do with NLS. Then he grabbed the key from a properties file to do a search among Java source files.  When the class was over, I asked him if it’s all right to insert a line of code to throw an exception. The stack trace from the JVM might give me a clue about the location of the bug. Well, he said that he and other developers sometimes would do that. Also, they would use System.out.println. He said, “Don’t be afraid to try out anything with the code.”

Tonight I was trying to map out the flow of control that has triggered NullPointerException that is related to my bug. After some tinkering, I used the”Search” feature and found out that the dropDown method was called 12  times in the ASDCCombo class. Then I inserted some System.out.println statements near those locations. The output in the console view on the development platform has given me an interesting trace of events and event handling. I still don’t know why there’s a null reference. Soon I realized that I should get an updated stack trace report since I’m using the most current build(3.1M5). I don’t know how to do it. I posted my request to the Bug Report.

After Angel Vera’s visit to our class, I felt somewhat empowered to fix the bug. He and Jordan have shown us different ways to locate a bug. What I and other students need to do now is try, try, try and nothing else.

Eclispe WTP – Helping Out Each Other

February 15, 2009

This afternoon I was browsing through our Weekly Schedule and noticed that Jordan has already posted The Fourth Milestone. If all of us reach this milestone by the end of Week 6, we will be heading toward the direction of helping out each other in this learning community. Let us do it together.

Also, to my surprise, Allen has contributed the contents of our Week 6 wiki! I really  appreciate his efforts. Some time ago, he set up a wiki page called Eclipse Tips. He’s pretty visionary. Now I can see that it will be another good place for all of us to help out each other. I just made a little  contribution there. I hope that all of us in this class will share more by blogging and adding contents to Eclipse Tips…  I know, each of us has to spend time with other courses as well as other demands in life.  Yet I see that something greater will arise when we connect with each other and help each other out instead of working silently on our own.

WTP Bug 256185 – 180 Degrees

February 13, 2009

My miserable situation has turned around by 180 degrees . This morning I got a piece of advice from Valentin in the newsgroup. I downloaded the 3.1M5 version of WTP. My problem disappeared. Now I could launch the target platform successfully with the the code I’ve checked out from HEAD.

I inserted some System.out.println statements in a Java class. When I tried to reproduce the bug on the target platform instance, the output was displayed in the console window on the *development* platform, not the target platform. I wonder if this has to do with plug-in technology. Very interesting indeed! I’m looking foward to Mr. Mandel’s visit to our class as he’s going to speak about Eclipse plug-in architecture. (You know what, he put a comment in my blog this morning.)

WTP Bug 256185 – A Miserable Week

February 12, 2009

After writing two postings, I would like to share about my miserable week. As I’m 100% green with WTP, I encountered two problems that have nothing to do programming per se. It reminds me of doing a science  experiment when I was a high school student. I’m still trying to set up the apparatus properly before I can tinker with the Java code. The first problem has been resolved after inspecting the Java code in light of the error messages. The second problem has to do with launching the target WTP platform from the development platform (i.e. the Plug In). Here’s my log on what I have gone through.

2/06(Friday)
After reading the stack trace attached to the Bug Report, I checked out the component org.eclipse.wst.wsdl.ui from the CVS reposistory. I got error messages from the compiler. I had followed all the steps in the tutorial. I decided to post up my problem as a comment to the Bug Report.

2/09(Monday)
I followed the red dots and inspected the Java import statements. Some classes such as org.eclipse.wst.wsdl.WSDLElement were not found. So I created a new workspace and checked out two compontes, namely org.eclipse.wst.wsdl and org.eclipse.wst.wsdl.ui. I didn’t get any error messages this time. I was SO glad that the problem was resolved.

Following the stack trace attached to the Bug Report, I inserted one line of Java code,  System.out.println( “1. dropDown…” ), in ASDCCombo.java. Then I tried to run it with the target WTP platform. (I already used the target platform to reproduce the bug successfully.) For some strange reason, the WSDL Editor was not launched at all.

After a while, I decided to look up Eclipse newsgroups (that was suggested by David Williams who commented my blog some time ago). I used “WSDL editor” as a search word. I was very surprised to know that someone had a similar problem. I was even more surprised that the problem was raised by Jesse Valianes, a student at Seneca. I never met him on the campus.

2/10(Tuesday)
I found out that Jesse’s problem was not the same as my problem. My target platform is 3.1M4 and I checked out the components from HEAD. I tried several times again to launch the target platform from the Plug In. It still failed. Finally I decided to post my problem to the newsgroup.

2/11(Wednesday)
Before I went to bed, I found out that Valentin had replied to my inquiry in the newsgroup.

2/12(Thurday)
I followed his suggestions. But  I still had the same problem. So this afternoon I posted some screenshots to the newsgroup again. I’m now waiting… Right now, I feel a kind of stuck. I know I have to be patient for the time being.  Nevertheless, I do feel being supported by the newsgroup and Valentin.

How are the other fellows in our WTP class doing? Mmm…

Eclipse WTP – It’s Worth Going To Class

February 12, 2009

I can’t believe it. Our WTP class has entered the fifth week now. On Tuesday (Feb. 10) Jordan wanted to show us how to use the Eclipse debugger to fix a bug. He has found some very helpful video clips. I recommend these tutorials to everyone in our class, especially those who were absent that day.  Jatinder showed us how the book, Eclipse Web Tools Platform: Developing Java™ Web Applications, has helped him to navigate through the packages in order to locate the bug. Watching his live demo was just different from reading his blog.  I hope that all of us can share and discuss our experiences when we meet as a class in the near future.  As for myself,  I’ll see if I will acquire a litte more experience in fixing a bug before Angel Vera from IBM shows up in our class next Tuesday.

Eclipse Bug Day – A Glimpse of Hope

February 12, 2009

It’s been a miserable week for me. I will share about that in another posting. I just read our course Main Page a few minutes ago. I felt hopeful when I saw an announcement about Eclipse BUG Day. It seems that it’s going to be an international event. I don’t know what’s going to happen on that day. Right now I feel stuck in fixing the bug; yet I will persevere since the Eclipse Bug Day is coming. Jordan, thanks for posting it up.

Eclipse WTP – Bug 256185 Reproduced

February 4, 2009

Bugzilla – Bug 256185

Description: Null pointer when changing reference kind in the properties view with type combo box open in design view

Build ID: WTP 3.1

Steps To Reproduce:
1. Open PhoneBanking/PhoneBanking.wsdl
2. Go to design view, select BillInfo from the payBill operation

design view

3. Right click and show properties. Make sure the properties view shows the general information for the part associated with BillInfo

properties view

4. In the design view, open the combo box. While the combo box is expanded (i.e. the list of options are open), click on the radio button “Type” in the properties view for Reference Kind

the radio button

5. A null pointer exception will be thrown

the problem dialog box

Eclipse WTP – Bug# 256185 Reproduced with Community Support

February 4, 2009

I’m often curious about the NullPointerExceptions thrown by the JVM. After reading Dave Humphrey’s encouraging comment to my blog, I decided to take a look at Bug# 256185 today. Kevin and Jatinder have blogged their experiences in reproducing their Bugs. I would like to be able to do so soon.

I tried to follow step 1 in the Bug’s Report. I knew I had to find or download the example somewhere in the WTP target environment. I used the Help Contents feature, even using “examples” as the search word. After a while, I felt that I was at a dead end. Then I remembered Jordan’s advice: Cry for help! As the last resort, I looked up the Bug Report again and emailed the QA contact person. Then I walked away from my laptop for a while…

An hour later, I already got a reply from Valentin Baciu. His reply was brief but very helpful. He first congratulated me for working on some of the WTP bugs. Then he showed me to use the XML Example project wizard to create the example that I tried SO hard to find. Lastly he referred me to ask questions through the Bug Report in the future. He has assured me that they are “typically fairly responsive.” As a result, I used the “login” feature on the Bug Report to enter my first comment there. I also added my email address to the “cc” list. Now I recall what Dave and Jordan have said some time ago: “There’s a community out there to support you.”

Fixing Eclipse WTP Bugs – Complicated, Difficult, But Not Alone

February 3, 2009

Our open source development course has entered the fourth week. Eight fellow students have already posted the Bugs that they want to work on. I need to catch up. Hopefully I will post up a Bug within two or three days. Otherwise I will miss the thrill and frustration of fixing a bug.

Our class today began with Jordan’s demonstration on fixing a Bug. Surely the Eclipse debugger was handy. He cared a lot about us. At different points of time, he asked us if we understood all the steps that he did. All of us were appalled when Jordan got it fixed. This only lasted for a moment though. Soon he showed us that another bug was introduced…

Then Jordan asked the students about their impression of fixing bugs. One student said that it was complicated because one had to go through many folders and classes. Then you wrote a few lines of code in a Java method. Another student said that it was difficult because you had to find the location of the bug. I agree. The whole process is like looking for a needle in a haystack (or in an ocean).

Jordan has given us some practical advice:
1. You don’t have to understand everything. Probably no one does.
2. Focus on a small piece of code.
3. Do not try to work alone.
4. Cry for help when you reach an impasse.

How may we put this into practice? Keep on blogging our experiences (both positive and negative) and use Eclipse WTP newsgroups as commented by David Williams. (I couldn’t believe that an experienced WTP developer has read my blog and put a comment there.)  I’ve checked out the newsgroups. Pretty neat.

Finally, Jordan asked Jat to give a demo on what he has experienced in reproducing “his” Bug (#203257).  His demo has sparked off discussion among the students. As mentioned in his blog , he has discovered something else (another glitch) that is not behaving nicely. Jordan advised us to draw a distinction between fixing a bug and enhancing a feature. Yes, our goal here is fixing bugs.