previous throws

From: "Keith Bottner" <kbottner(at)comcast(dot)net>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: previous throws
Date: 2003-12-30 01:18:06
Message-ID: 000001c3ce72$c7e8eb30$7d00a8c0@juxtapose
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Although I have been using postgres for a while I just recently started
using the JDBC driver. I found after retrieving a result set, calling
afterLast() and then calling previous() a java.lang.NullPointerException is
thrown. Looking at the source for previous in AbstractJdbc2ResultSet.class

public boolean previous() throws SQLException {
if (--current_row < 0)
return false;
this_row = (byte[][]) rows.elementAt(current_row);
System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
return true;
}

the rowBuffer is never allocated and is null which actually causes the
error. All other methods that use rowBuffer include a line that resembles
this:\

rowBuffer = new byte[this_row.length][];

If I call any other method that allocates rowBuffer then previous works
fine. So in short, should I be calling another method prior to calling
previous to initialize the rowBuffer? I believe that this is a bug, and it
is present in the most current driver, but I wanted to run it by the JDBC
list to make sure before submitting the fix.

Thanks,

Keith

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2003-12-30 01:26:54 Re: previous throws
Previous Message David Wall 2003-12-30 01:09:32 Multi-threaded servlet environment