Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to handle null pointer exception in session handling

Sardar NaleJul 17 2012 — edited Jul 17 2012
Hi ,
I am using jdeveloper version 11.1.1.6.0 .
I am storing session using following code
        abcList  = new ArrayList<abcVO>();             
        JSFUtils.storeOnSession("key",abcList  );
and retrive it using following sentense
         abcList  = (ArrayList<abcVO>) JSFUtils.getFromSession("key");
It is ok I am able to get the session value because I store it first .
But I want to know whether list is stored in session scope earlier if no then want to store it
If data is not present in session and i am getting its value before it is stored it throws null pointer exception
  
        abcList  = (ArrayList<abcVO>) JSFUtils.getFromSession("key");
How to check whether value is null or not null before accessing session.
This post has been answered by Frank Nimphius-Oracle on Jul 17 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 14 2012
Added on Jul 17 2012
2 comments
205 views