Re: NullPointerExceptions in empty ResultSets

From: Dave Cramer <Dave(at)micro-automation(dot)net>
To: floyds(at)4peakstech(dot)com
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: NullPointerExceptions in empty ResultSets
Date: 2002-06-13 18:16:55
Message-ID: 1023992215.1542.206.camel@inspiron.cramers
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Try downloading the dev jar

I just tried

public void testEmptyResult()
{
try
{
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM testrs where
id=100");
rs.beforeFirst();
rs.afterLast();
assertTrue(!rs.first());
assertTrue(!rs.last());
assertTrue(!rs.next());

}
catch ( Exception ex )
{
fail( ex.getMessage() );
}

and it passed with no problem

DAve
On Thu, 2002-06-13 at 14:00, Floyd Shackelford wrote:
>
> i just upgraded to the latest jdbc driver and am now getting errors in empty
> ResultSets (i.e. the sql select returned 0 rows) where i used to not get an
> error. here are some examples:
>
> java.lang.NullPointerException at
> org.postgresql.jdbc2.ResultSet.beforeFirst(ResultSet.java:876)
>
> java.lang.NullPointerException at
> org.postgresql.jdbc2.ResultSet.last(ResultSet.java:1133)
>
> please let me know if this is an error and if so:
>
> 1. how do i work around it for now
> 2. when can i have a new version of the jdbc jar file?
>
> Regards,
>
> Floyd Shackelford
> 4 Peaks Technology Group, Inc.
> VOICE: 334.735.9428
> FAX: 916.404.7125
> EMAIL: FloydS(at)4PeaksTech(dot)com
> ICQ #: 161371538
> acta non verba
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.370 / Virus Database: 205 - Release Date: 6/5/2002
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.370 / Virus Database: 205 - Release Date: 6/5/2002
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.370 / Virus Database: 205 - Release Date: 6/5/2002

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message tony 2002-06-13 18:48:20 Re: NullPointerExceptions in empty ResultSets
Previous Message Floyd Shackelford 2002-06-13 18:00:44 NullPointerExceptions in empty ResultSets