You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Leif Mortenson <le...@silveregg.co.jp> on 2002/01/23 01:41:37 UTC

Potential NullPointerException in AbstractJdbcConnection

I just noticed a potential bug on line 131 of
org.apache.avalon.excalibur.datasource.AbstractJdbcConnection while
looking at the code. If keepAlive is null, you will get a
NullPointerException.
if (null == keepAlive && "".equals(keepAlive.trim()))

This should be:
if (null == keepAlive || "".equals(keepAlive.trim()))

Cheers,
Leif



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Potential NullPointerException in AbstractJdbcConnection

Posted by Berin Loritsch <bl...@apache.org>.
Leif Mortenson wrote:

> I just noticed a potential bug on line 131 of
> org.apache.avalon.excalibur.datasource.AbstractJdbcConnection while
> looking at the code. If keepAlive is null, you will get a
> NullPointerException.
> if (null == keepAlive && "".equals(keepAlive.trim()))
> 
> This should be:
> if (null == keepAlive || "".equals(keepAlive.trim()))


Applied this. (and fixed the line feed issue)


-- 

"They that give up essential liberty to obtain a little temporary safety
 deserve neither liberty nor safety."
                - Benjamin Franklin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>