Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Problem with NullPointerException Error  RSS feed

 
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am Having a problem with Null Pointer Exception. I have this method which i know can return a Null result

if (message.getJMSCorrelationID().equals(null)){
message.setJMSCorrelationID("1");
}

And i am doing the test and i have taking care of the Null problem by setting the JMSCorrelationID to 1, but its still giving me an error, Jumping to the Catch Block Instead
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Abiodun Oyesiji:
Hello,
I am Having a problem with Null Pointer Exception. I have this method which i know can return a Null result

if (message.getJMSCorrelationID().equals(null)){
message.setJMSCorrelationID("1");
}

And i am doing the test and i have taking care of the Null problem by setting the JMSCorrelationID to 1, but its still giving me an error, Jumping to the Catch Block Instead



Try
 
Abiodun Adisa
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tried That Still not working
 
author
Posts: 23832
140
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't guess on what could be causing the NPE. The stack trace actually does a great job at giving you the file and line number where the exception occured.

You should confirm that it is actually where you think it is first.

Henry
 
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Joanne Neal:



Alternatively you can try this one



But you must show the stack trace, this can be possible that the original source of nullPointerException can be unawered by you completely.

Pls share the stack trace alongwith the code so that we can identify the nullpointer exception.

Hope this helps you.
 
It's fun to be me, and still legal in 9 states! Wanna see my tiny ad?
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!