• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Null Pointer Exception

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic