| Author |
Null Pointer Exception
|
Schandha Ravi
Ranch Hand
Joined: Oct 20, 2007
Posts: 167
|
|
Hi All, I'm working with HtmlUnit to test a sample web application. But I'm getting a NullPointerException. I'm not able to figure out where and why the exception is generated. I'm not getting the code displayed under if condition. Can some one guide me here.
|
Thanks & Regards, SK
SCJP 5.0, DB2 - 800, DB2 - 803, SCDJWS (On the way)
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26192
|
|
Schandha, What line is generating the null pointer? (You can look at the junit report for a stack trace)
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Schandha Ravi
Ranch Hand
Joined: Oct 20, 2007
Posts: 167
|
|
Hi Jeanne, From the stack trace, the exception is generated at Not sure why there is an abend. Infact requestSettings is properly intantiated and it has some values. Something went wrong in loadWenResponse Also I ran the testcase in debug mode, but at the line 34 One more observation is, I'm always getting this exception when ever I call any method on WebClient object. Is the way I initialized WebClient, wrong.
|
 |
Schandha Ravi
Ranch Hand
Joined: Oct 20, 2007
Posts: 167
|
|
That was my bad. I found the mistake. Apparently WebClient object is null. I have the local object created in setUp() which is apparently not available in testcase. Its fine now.
|
 |
 |
|
|
subject: Null Pointer Exception
|
|
|