Source : com/sun/rowset/CachedRowSetImpl.java
1613 protected BaseRow getCurrentRow() {
1614 if (onInsertRow == true) {
1615 return (BaseRow)insertRow;
1616 } else {
1617 return (BaseRow)(rvh.get(cursorPos - 1)); <==== SHOULD CHECK FOR 0
1618 }
1619 }
Sample Test Code:
crs = new com.sun.rowset.CachedRowSetImpl();
logMsg("\nTest 3:Updating the value of 1st row to 33333333.40");
crs.first();
logMsg("Are we at first row ? " + crs.isFirst());
crs.updateDouble(1, 33333333.40);
logMsg("Has the column 1 been updated? : " + crs.columnUpdated(1));
crs.updateRow();
crs.acceptChanges();
crs.commit();
Test Execution Output:
[2006-12-11T23:43:59.08] Test java.lang.ArrayIndexOutOfBoundsException: -1
[2006-12-11T23:43:59.31] at java.util.Vector.get(Vector.java:696)
[2006-12-11T23:43:59.31] at com.sun.rowset.CachedRowSetImpl.getCurrentRow(Unknown Source)
[2006-12-11T23:43:59.31] at com.sun.rowset.CachedRowSetImpl.updateDouble(Unknown Source)
[2006-12-11T23:43:59.31] at DefaultCRSBehavior.doTest(DefaultCRSBehavior.java:146)
[2006-12-11T23:43:59.31] at DefaultCRSBehavior.main(DefaultCRSBehavior.java:254)
[2006-12-11T23:43:59.31] # Test level exit status: 0
[2006-12-11T23:43:59.31] 3:Updating the value of 1st row to 33333333.40
[2006-12-11T23:43:59.31] Are we at first row ? true
[2006-12-11T23:43:59.31] SOURCE DEBUG: cursorPos - 1 = -1
[2006-12-11T23:43:59.31] DEBUG: Exception caught: -1