previous throws - Mailing list pgsql-jdbc

From Keith Bottner
Subject previous throws
Date
Msg-id 000001c3ce72$c7e8eb30$7d00a8c0@juxtapose
Whole thread Raw
Responses Re: previous throws
List 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


pgsql-jdbc by date:

Previous
From: "David Wall"
Date:
Subject: Multi-threaded servlet environment
Next
From: Kris Jurka
Date:
Subject: Re: previous throws