Обсуждение: ResultSet.previous() - ArrayIndexOutOfBoundsException

Поиск
Список
Период
Сортировка

ResultSet.previous() - ArrayIndexOutOfBoundsException

От
Fischer Krisztián
Дата:
Hi!

I use PostgreSQL 7.4.1 through the shipped JDBC driver. In some
circumstances the driver throws the following exception:

[...]
java.lang.ArrayIndexOutOfBoundsException: 1 >= 0
         at java.util.Vector.elementAt(Vector.java:431)
         at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.previous(AbstractJdbc2ResultSet.java:495)
         at
com.bh.server.implementation.SQLObject.previousRow(SQLObject.java:583)
         at com.bh.server.implementation.DSF3.getBlock(DSF3.java:3916)
         at
com.bh.server.implementation.DSF3.getPreviousBlock(DSF3.java:2302)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
         at sun.rmi.transport.Transport$1.run(Transport.java:148)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
         at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
         at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:534)
[...]

I wrote a lot's of test, but i cannot reproduce the problem in a simple
form. However my real application (a quite huge one) produces the
exception above constantly. I guessed it's related to some
synchronization issue, but after making my ResultSet-wrapper object
thread safe, the problem still exists. So maybe it's a bug in the driver.

Has anyone such 'experiences'? Or some tips where do i mess it up?

Thanks in advance.

--
Fischer Krisztián <fischer@borganization.com>
Tel: (+36)70/3843835, (+36)1/3360547
Borganization Kft.


Re: ResultSet.previous() - ArrayIndexOutOfBoundsException

От
Kris Jurka
Дата:

On Mon, 19 Jan 2004, [ISO-8859-2] Fischer Kriszti�n wrote:

> Hi!
>
> I use PostgreSQL 7.4.1 through the shipped JDBC driver. In some
> circumstances the driver throws the following exception:
>
> [...]
> java.lang.ArrayIndexOutOfBoundsException: 1 >= 0
>          at java.util.Vector.elementAt(Vector.java:431)
>          at
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.previous(AbstractJdbc2ResultSet.java:495)
>          at
> com.bh.server.implementation.SQLObject.previousRow(SQLObject.java:583)


Here's a sample program to demonstrate the problem.  Basically it assumes
that rs.next() won't be called after it returns false.  The same problem
is also true in reverse, calling previous and then next will show the same
issue.  I should hopefully have a patch for this later today.

Kris Jurka


Вложения

Re: ResultSet.previous() - ArrayIndexOutOfBoundsException

От
Kris Jurka
Дата:

On Mon, 19 Jan 2004, Kris Jurka wrote:

>
>
> On Mon, 19 Jan 2004, [ISO-8859-2] Fischer Kriszti�n wrote:
>
> > Hi!
> >
> > I use PostgreSQL 7.4.1 through the shipped JDBC driver. In some
> > circumstances the driver throws the following exception:
> >
> > [...]
> > java.lang.ArrayIndexOutOfBoundsException: 1 >= 0
> >          at java.util.Vector.elementAt(Vector.java:431)
> >          at
> > org.postgresql.jdbc2.AbstractJdbc2ResultSet.previous(AbstractJdbc2ResultSet.java:495)
> >          at
> > com.bh.server.implementation.SQLObject.previousRow(SQLObject.java:583)
>
>
> Here's a sample program to demonstrate the problem.  Basically it assumes
> that rs.next() won't be called after it returns false.  The same problem
> is also true in reverse, calling previous and then next will show the same
> issue.  I should hopefully have a patch for this later today.
>

I have applied a patch to fix this problem to the cvs version on gborg.
Here is the equivalent patch for the 7.4 series driver.

Kris Jurka

Вложения

Re: ResultSet.previous() - ArrayIndexOutOfBoundsException

От
Fischer Krisztián
Дата:
Thanks for the fast response and for the patch Kris!


--
Fischer Krisztián <fischer@borganization.com>
Tel: (+36)70/3843835, (+36)1/3360547
Borganization Kft.