previous throws
previous throws
От:
"Keith Bottner" <kbottner@comcast.net>
Дата:
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
Re: previous throws
От:
Kris Jurka <books@ejurka.com>
Дата:
On Mon, 29 Dec 2003, Keith Bottner wrote: > 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 I fixed this in bug in early November, but it didn't get backpatched to the 7.4 branch until the middle of December to make the 7.4.1 release. Kris Jurka