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