db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernt M. Johnsen" <Bernt.John...@Sun.COM>
Subject Re: [jira] Commented: (DERBY-276) ResultSet.relative(int row) cannot be called when the cursor is not positioned on a row.
Date Mon, 13 Jun 2005 20:12:41 GMT
>>>>>>>>>>>> Myrna van Lunteren wrote (2005-06-13 11:26:52):
> The patch applied when I svn updated to the revision in the patch...
> And the 2 tests pass...
>  But I was wondering - should there be a test case for the NPE situation in 
> one of the scrollCursors tests?

Probably. I could add a test for all positioning methods en empty
scrollable resultsets. Should be no big deal.

>  Myrna
> 
>  On 6/13/05, Bernt M. Johnsen (JIRA) <derby-dev@db.apache.org> wrote: 
> > 
> > [ 
> > http://issues.apache.org/jira/browse/DERBY-276?page=comments#action_12313430]
> > 
> > Bernt M. Johnsen commented on DERBY-276:
> > ----------------------------------------
> > 
> > The mailed patch has a minor issue. It gives NPE when relative(0) is 
> > acalled on an emtpy resultset.
> > 
> > > ResultSet.relative(int row) cannot be called when the cursor is not 
> > positioned on a row.
> > > 
> > ----------------------------------------------------------------------------------------
> > >
> > > Key: DERBY-276
> > > URL: http://issues.apache.org/jira/browse/DERBY-276
> > > Project: Derby
> > > Type: Improvement
> > > Components: JDBC
> > > Reporter: Bernt M. Johnsen
> > > Assignee: Bernt M. Johnsen
> > > Priority: Minor
> > 
> > >
> > > If the cursor is not positioned on a row, calling ResultSet.relative() 
> > causes the following exception:
> > > Exception in thread "main" ERROR X0X87: ResultSet.relative(int row) 
> > cannot be called when the cursor is not positioned on a row.
> > > at org.apache.derby.iapi.error.StandardException.newException(
> > StandardException.java:301)
> > > at 
> > org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getRelativeRow
> > (ScrollInsensitiveResultSet.java:336)
> > > at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(
> > EmbedResultSet.java:366)
> > > at org.apache.derby.impl.jdbc.EmbedResultSet.relative(
> > EmbedResultSet.java:1840)
> > > However, The 1.4.2 Javadoc says:
> > > Note: Calling the method relative(1) is identical to calling the method 
> > next() and calling the method relative(-1) is identical to calling the 
> > method previous(). (This is confirmed by the JDBC 3.0 spec, ch. 14.2.2)
> > > Since next() is valid, so should rs.relative(1) (and all other 
> > arguments, since a too large value will position the
> > > cursor after the last row, and a too low value will position it before 
> > the first).
> > 
> > --
> > This message is automatically generated by JIRA.
> > -
> > If you think it was sent incorrectly contact one of the administrators:
> > http://issues.apache.org/jira/secure/Administrators.jspa
> > -
> > For more information on JIRA, see:
> > http://www.atlassian.com/software/jira
> > 
> >

-- 
Bernt Marius Johnsen, Database Technology Group, 
Sun Microsystems, Trondheim, Norway

Mime
View raw message