Wednesday, September 26, 2007

11 WebSpider (revised)

Source Code: Available here

First of all, it was a good experience having this assignment extended because I was able to improve my logging feature which is implemented with java.util.Logging.Logger. Although, my web spider was working already before, I decided to revise the code and add more security to it. Therefore, I have surrounded necessary code with try and catch blocks. The only problem associated with it is when running Emma on it. Since the code won't always go through the catch block, Emma will complain about it and the coverage drops down from the expected 100%. But at least it won't stop the code execution when a link is down or when a website is not accessible. In addition, I think that writing Junit tests isn't always very easy. Sometimes it seems like Junit tests are not necessary for certain blocks of code but then Emma coverages will drop. So, to satisfy this I must write a test which just goes through a block which only contains a print statement. I have also found a way of turning off the scripting errors in httpunit and therefore my code works for nearly all web pages, including myspace.com.

No comments: