You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Andy Olliver <an...@unfortu.net> on 2002/09/17 01:19:27 UTC
[DBCP] DelegatingResultSet.close() -> NullPointerException
DBCP v1.0
I have had to make a quick fix to DelegatingResultSet to fix a problem.
It is the 'wrong fix' but it keeps things working for me, until I have the
correct fix.
I use a connection to execute a query that returns no resultset, however I
still get a non-null DelegatingResltSet returned, containing a null
resultset as instance variable '_res'.
Calling .close() throws a NullPointerException, however as a 'user' of the
datasource there is no way of checking the state of private variabe '_res'.
I have added a check to the close method:
if (_res != null) _res.close;
But actually the DelegatingResultSet should never be created in the first
place, the stmt.execute() method should just return null.
bests
Andy
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.381 / Virus Database: 214 - Release Date: 02/08/2002
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [DBCP] DelegatingResultSet.close() -> NullPointerException
Posted by Tim Funk <fu...@joedog.org>.
Yup - its a problem.
The following classes have this problem because getResultSet() doesn't
check for a null return.
- DelegatingPreparedStatement
- DelegatingCallableStatement
- DelegatingPreparedStatement
I just submitted a bug report and patch to fix this.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12733
Andy Olliver wrote:
> DBCP v1.0
> I have had to make a quick fix to DelegatingResultSet to fix a problem.
> It is the 'wrong fix' but it keeps things working for me, until I have the
> correct fix.
>
> I use a connection to execute a query that returns no resultset, however I
> still get a non-null DelegatingResltSet returned, containing a null
> resultset as instance variable '_res'.
>
> Calling .close() throws a NullPointerException, however as a 'user' of the
> datasource there is no way of checking the state of private variabe '_res'.
>
> I have added a check to the close method:
>
> if (_res != null) _res.close;
>
> But actually the DelegatingResultSet should never be created in the first
> place, the stmt.execute() method should just return null.
>
> bests
>
> Andy
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.381 / Virus Database: 214 - Release Date: 02/08/2002
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>