File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Null Pointer Exception

 
Schandha Ravi
Ranch Hand
Posts: 167
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33713
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Schandha,
What line is generating the null pointer? (You can look at the junit report for a stack trace)
 
Schandha Ravi
Ranch Hand
Posts: 167
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 167
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic