Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.NullPointerException

 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

My following code throws java.lang.NullPointerException



StackTrace:

Line
470: tempClob.freeTemporary();
492: edu = getClob(education, cnn);

Thanks in anticipation

 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You see in the sample code you have posted- at Line 2 - tempClob is null and its initialized only in the try block. But when its being used in the catch block it may be or may not be initialized.
May be because- CLOB.createTemporary successfully executes.
May not be because- there was some exception while executing CLOB.createTemporary and hence tempClob is not initialized.

So in you catch you need to check if tempClob is initialized before you execute tasks of cleaning.
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not able to fix it
 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your catch block you add this check-


But the cleanup has to be done in finally - catch block may not be executed when there is no exception. But finally block is always executed. So you have to add
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now its throwing the following exception:
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. And do you have a particular question about that stack trace?
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UserDAO.insertInToDetailResume(UserDAO.java:196) is:


BulkUpload.doPost(BulkUpload.java:239) is:


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic