commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernard, Shawn" <Shawn.Bern...@turner.com>
Subject RE: Problem with Result Set returning null instead of Empty String
Date Wed, 25 Jan 2006 12:43:23 GMT
I know this doesn't really answer your question, but if you switch your trim() calls to StringUtils.trim()
then you avoid a possible NullPointerException since the StringUtils version is nullsafe.

-Shawn

-----Original Message-----
From: Chetan [mailto:chetan.arora@ebusinessware.us]
Sent: Wednesday, January 25, 2006 4:50 AM
To: commons-user@jakarta.apache.org
Subject: Problem with Result Set returning null instead of Empty String


Hi,

I have a web application running on Tomcat 4.0. In it i have implemented by
own Connection Pool. Now im trying to use the DBCP connection broker to
handle message pools. I have managed in doing so but ther's just one
problem:

Earlier in my code, whenever i was doing a resultSet.getString('some column
name'), the return value would be an empty string ('') in case the column in
the database was null. However, after using DBCP, similar statements return
null and since in a lot of places, i have done operations such as trim() etc
on these returned Strings, i am getting null pointer exceptions all over the
place!

Is there any way by which i could make the DBCP connection broker return an
empty string instead of a null so that i dont need to make changes in
numerous places in my application to handle the null pointer case ?

Thanks and Regards,

Chetan Arora

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message