Re: nullPointerException when accessing fields of an object

From: Terry <terryfellows7_at_hotmail.com>
Date: 6 Dec 2001 14:48:59 -0800
Message-ID: <67dc4a8a.0112061448.4ee780da_at_posting.google.com>


i have had a lot of the same types of problems in the different data bases i work with. not exactly the same product.

what we had to do was GET only objects, and then, something like,

   String sDataObject = String.valueOf(oDataObject);    if (sDataObject.equals("null")){sDataObject = "";}

i would get the null pointer error when, putting sql null's into hashtables as a value and not even a key. and sometimes into other Container Classes, but i didn't narrow this down.

we had problems with number's coming back as SQL null.

djuravel_at_dgny.com (deejay) wrote in message news:<f7b19882.0112050845.3c62d5ee_at_posting.google.com>...
> I'm working with an Oracle 8i database on Solaris. My oracle objects
> are converted to java objects via jpublisher's utility. One problem
> I'm encountering is when I do a get() on one field of the jpublished
> objects, if there's no value in that field, it will throw a
> nullPointerException. I can't even test if get() == null because that
> itself will throw an exception. I was wondering how I can get around
> this other than initialize the object to empty strings or fake values.
> Thanx for your help.
>
> Deejay
Received on Thu Dec 06 2001 - 23:48:59 CET

Original text of this message