A DESCRIPTION OF THE PROBLEM :
In source of b86 I found:
// if the call is relative and the cursorPosition
// is before/after the ResultSet return the respective
// out of bounds exception.
if (relative)
{
if (rowPosition == 0)
{
throw new SQLException
("Cursor is positioned before the ResultSet");
}
else if (rowPosition > numberOfRows)
{
throw new SQLException
("Cursor is positioned after the ResultSet");
}
}
This behavior does not match to the current doc. Method relative() is
the _only_ cursor-moving method in ResultSet wich is coded to throw an
SQLException if there is no current row, I suggest to discard this cause
for the SQLException. It's enough to have the return value as "false" in
this case.
In docs for method relative() we have:
"Note: Calling the method relative(1) is identical to calling the method next() ..."
and
"SQLException - ...., there is no current row, ...."
In docs for method next() there is _no_ hint like
"SQLException - ...., there is no current row, ...."
Because method relative() is the _only_ cursor-moving method in ResultSet wich should throw an SQLException if there is no current row, I suggest to discard this cause for the SQLException. It's enough to have returned a false in this case.
On the other hand, I suggest to add, that an SQLException is thrown if a columnName or columnIndex is wrong for the updatexxx methods, instead of doing nothing.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
method ResultSet#relative() :
"SQLException - ...., ...."
method ResultSet#updatexxx() :
"SQLException - ...., if columnXxxx is wrong"
ACTUAL -
method ResultSet#relative() :
"SQLException - ...., there is no current row, ...."
method ResultSet#updatexxx() :
"SQLException - ...., ...."
URL OF FAULTY DOCUMENTATION :
jdk1.6.0/docs/api/java/sql/ResultSet.html#relative(int)
In source of b86 I found:
// if the call is relative and the cursorPosition
// is before/after the ResultSet return the respective
// out of bounds exception.
if (relative)
{
if (rowPosition == 0)
{
throw new SQLException
("Cursor is positioned before the ResultSet");
}
else if (rowPosition > numberOfRows)
{
throw new SQLException
("Cursor is positioned after the ResultSet");
}
}
This behavior does not match to the current doc. Method relative() is
the _only_ cursor-moving method in ResultSet wich is coded to throw an
SQLException if there is no current row, I suggest to discard this cause
for the SQLException. It's enough to have the return value as "false" in
this case.
In docs for method relative() we have:
"Note: Calling the method relative(1) is identical to calling the method next() ..."
and
"SQLException - ...., there is no current row, ...."
In docs for method next() there is _no_ hint like
"SQLException - ...., there is no current row, ...."
Because method relative() is the _only_ cursor-moving method in ResultSet wich should throw an SQLException if there is no current row, I suggest to discard this cause for the SQLException. It's enough to have returned a false in this case.
On the other hand, I suggest to add, that an SQLException is thrown if a columnName or columnIndex is wrong for the updatexxx methods, instead of doing nothing.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
method ResultSet#relative() :
"SQLException - ...., ...."
method ResultSet#updatexxx() :
"SQLException - ...., if columnXxxx is wrong"
ACTUAL -
method ResultSet#relative() :
"SQLException - ...., there is no current row, ...."
method ResultSet#updatexxx() :
"SQLException - ...., ...."
URL OF FAULTY DOCUMENTATION :
jdk1.6.0/docs/api/java/sql/ResultSet.html#relative(int)