When rows.close();
SQLWarning warning = rows.getWarnings(); are invoked,
it throws a java.lang.UnsupportedOperationException.
I think it should throw SQLRuntimeException. See Docs.
From the Docs.
==========================
getWarnings
SQLWarning getWarnings()
Retrieves the first warning reported by invoking methods on this DataSet object. Subsequent DataSet object warnings will be chained to this SQLWarning object.
The warning chain is automatically cleared each time a new row is read. This method may not be called on a closed DataSet object; doing so will cause an SQLRuntimeException to be thrown.
Returns:
the first SQLWarning object or null if there are no warnings
Throws:
SQLRuntimeException - if a database access error occurs or this method is called on a closed DataSet Object
Since:
1.6
JDK : 1.5.0-b59
DB : ORCL
VM : default
switch/Mode : default
Platform[s] : Sol 10 sparc
Test owner :
Failing Test :
java_sql_eod/dataset/DataSet003_011
java_sql_eod/dataset/DataSet003_012
java_sql_eod/dataset/DataSet003_013
java_sql_eod/dataset/DataSet003_014 ---> clearWarning()
TestBase Location:
==================
/net/cady.sfbay/export/sqa/tcheung/jdbc/SQE/6.0
Test source location:
=====================
/net/cady.sfbay/export/sqa/tcheung/jdbc/SQE/6.0/jdbc/src/java_sql_eod/dataset/DataSet003_011/*.java
Share source location:
======================
/net/cady/export/sqa/tcheung/jdbc/SQE/6.0/jdbc/share
/net/cady/export/sqa/tcheung/jdbc/SQE/6.0/share
tlog file location:
==================
/net/cady.sfbay/export/sqa/tcheung/jdbc/BUGS/[bug id]
How to reproduce:
====================
1. cd /net/cady.sfbay/export/sqa/tcheung/jdbc/BUGS/[bug id]
2. ksh DataSet003_011.tlog [your JDK}
or
1) Copy the setup and Run_Standalone.ksh from $TestBase/jdbc to your local dir.
cp /net/cady.sfbay/export/sqa/tcheung/jdbc/SQE/6.0/jdbc/Run_Standalone.ksh .
2) Craete a your testlist.
echo "java_sql_eod/dataset/DataSet003_011 compile_and_execute" > mytestlist
3) Overwrite the default environment variables.
export PIT_HOME=/net/cady.sfbay/export/sqa/tcheung/jdbc/SQE/6.0
export TESTLIST = `pwd`/mytestlist
export JDK_PATH="your jdk"
if needed.
export VM_OPTS=""
export DB_NAME=""
export DB_DRIVER_NAME=""
export DB_CONNECTION_NAME=""
export DB_CONNECTION_STRING=""
export DB_LOGIN_NAME=""
export DB_LOGIN_PASSWORD=""
4) Run_Standalone.ksh.
Read $TestBase/jdbc/docs/Run_Standalone.README for more detail.
--------Sample Test/Script START---------------------
******* Sample test will not run as standalone java program ******
try {
rows = query.getPersonInfo(arg);
}catch (SQLRuntimeException ex) {
System.err.println(this.getClass().getName()+".doTest() : SQLRuntimeException caught when executing @Select : "+ex.getMessage());
throw new TestFailureException
("Un-Expected SQLRuntimeException when getting DataSet by executing @Select. [Message="+ex.getMessage()+"]", ex);
}
finally {
utils.closeConnection(con);
}
if (null == rows || rows.size() != 1) {
System.out.println(this.getClass().getName()+".doTest() : DataSet returned by @Select is null/empty. TEST FAILED");
throw new TestFailureException("DataSet returned by @Select is null/empty. TEST FAILED");
}
System.out.println(this.getClass().getName()+".doTest() : Got Dataset. Calling DataSet.close()");
// close the DataSet..
try {
rows.close();
} catch (SQLRuntimeException ex) {
System.err.println(this.getClass().getName()+".doTest() : SQLRuntimeException caught when executing DataSet.close() : "+ex.getMessage());
throw new TestFailureException
("Un Expected SQLRuntimeException when executing DataSet.close(). [Message="+ex.getMessage()+"]", ex);
}
System.out.println(this.getClass().getName()+".doTest() : Calling DataSet.getWarnings()");
//now call DataSet.getWarnings()
try {
SQLWarning warning = rows.getWarnings();
} catch (SQLRuntimeException ex) {
System.out.println(this.getClass().getName()+".doTest() : SQLRuntimeException caught as expected. [Message="+ex.getMessage()+"]");
System.out.println(this.getClass().getName()+".doTest() : TEST PASSED ");
return;
}
interface I_Query006 extends BaseQuery {
@Select(sql="SELECT firstName, lastName, id, age from dataset003 where lastName=?1")
DataSet<PersonInfo> getPersonInfo(String str) throws SQLRuntimeException;
}
--------Sample Test/Script END----------------------
Test output:
=============
/net/koori.sfbay/onestop/jdk/1.6.0/latest/binaries/solaris-sparc
TEST_ARGS=./orcl
End of TEST_PROLOG
Calling doSetup()....
Returned from doSetup()....
Calling doTest()....
DataSet003_011.doTest() : getting Connection object....
DataSet003_011.doTest() : getting QueryObject handle(JDBC 3.0)....
DataSet003_011.doTest() : got QueryObject handle(JDBC 3.0)
DataSet003_011.doTest() : Executing @Select....
DataSet003_011.doTest() : Got Dataset. Calling DataSet.close()
DataSet003_011.doTest() : Calling DataSet.getWarnings()
Exception in thread "main" java.lang.UnsupportedOperationException: Operation not supported
at com.sun.sql.DataSetImpl.getWarnings(DataSetImpl.java:1696)
at DataSet003_011.doTest(DataSet003_011.java:98)
at DataSet003_011.main(DataSet003_011.java:165)
Specific Machine Info:
=====================
For Solaris[sparc/x86] ->
5.10 Generic sun4u sparc SUNW,Ultra-60
clearWarnings() is thowing the same exception as getWarning()
SQLWarning warning = rows.getWarnings(); are invoked,
it throws a java.lang.UnsupportedOperationException.
I think it should throw SQLRuntimeException. See Docs.
From the Docs.
==========================
getWarnings
SQLWarning getWarnings()
Retrieves the first warning reported by invoking methods on this DataSet object. Subsequent DataSet object warnings will be chained to this SQLWarning object.
The warning chain is automatically cleared each time a new row is read. This method may not be called on a closed DataSet object; doing so will cause an SQLRuntimeException to be thrown.
Returns:
the first SQLWarning object or null if there are no warnings
Throws:
SQLRuntimeException - if a database access error occurs or this method is called on a closed DataSet Object
Since:
1.6
JDK : 1.5.0-b59
DB : ORCL
VM : default
switch/Mode : default
Platform[s] : Sol 10 sparc
Test owner :
Failing Test :
java_sql_eod/dataset/DataSet003_011
java_sql_eod/dataset/DataSet003_012
java_sql_eod/dataset/DataSet003_013
java_sql_eod/dataset/DataSet003_014 ---> clearWarning()
TestBase Location:
==================
/net/cady.sfbay/export/sqa/tcheung/jdbc/SQE/6.0
Test source location:
=====================
/net/cady.sfbay/export/sqa/tcheung/jdbc/SQE/6.0/jdbc/src/java_sql_eod/dataset/DataSet003_011/*.java
Share source location:
======================
/net/cady/export/sqa/tcheung/jdbc/SQE/6.0/jdbc/share
/net/cady/export/sqa/tcheung/jdbc/SQE/6.0/share
tlog file location:
==================
/net/cady.sfbay/export/sqa/tcheung/jdbc/BUGS/[bug id]
How to reproduce:
====================
1. cd /net/cady.sfbay/export/sqa/tcheung/jdbc/BUGS/[bug id]
2. ksh DataSet003_011.tlog [your JDK}
or
1) Copy the setup and Run_Standalone.ksh from $TestBase/jdbc to your local dir.
cp /net/cady.sfbay/export/sqa/tcheung/jdbc/SQE/6.0/jdbc/Run_Standalone.ksh .
2) Craete a your testlist.
echo "java_sql_eod/dataset/DataSet003_011 compile_and_execute" > mytestlist
3) Overwrite the default environment variables.
export PIT_HOME=/net/cady.sfbay/export/sqa/tcheung/jdbc/SQE/6.0
export TESTLIST = `pwd`/mytestlist
export JDK_PATH="your jdk"
if needed.
export VM_OPTS=""
export DB_NAME=""
export DB_DRIVER_NAME=""
export DB_CONNECTION_NAME=""
export DB_CONNECTION_STRING=""
export DB_LOGIN_NAME=""
export DB_LOGIN_PASSWORD=""
4) Run_Standalone.ksh.
Read $TestBase/jdbc/docs/Run_Standalone.README for more detail.
--------Sample Test/Script START---------------------
******* Sample test will not run as standalone java program ******
try {
rows = query.getPersonInfo(arg);
}catch (SQLRuntimeException ex) {
System.err.println(this.getClass().getName()+".doTest() : SQLRuntimeException caught when executing @Select : "+ex.getMessage());
throw new TestFailureException
("Un-Expected SQLRuntimeException when getting DataSet by executing @Select. [Message="+ex.getMessage()+"]", ex);
}
finally {
utils.closeConnection(con);
}
if (null == rows || rows.size() != 1) {
System.out.println(this.getClass().getName()+".doTest() : DataSet returned by @Select is null/empty. TEST FAILED");
throw new TestFailureException("DataSet returned by @Select is null/empty. TEST FAILED");
}
System.out.println(this.getClass().getName()+".doTest() : Got Dataset. Calling DataSet.close()");
// close the DataSet..
try {
rows.close();
} catch (SQLRuntimeException ex) {
System.err.println(this.getClass().getName()+".doTest() : SQLRuntimeException caught when executing DataSet.close() : "+ex.getMessage());
throw new TestFailureException
("Un Expected SQLRuntimeException when executing DataSet.close(). [Message="+ex.getMessage()+"]", ex);
}
System.out.println(this.getClass().getName()+".doTest() : Calling DataSet.getWarnings()");
//now call DataSet.getWarnings()
try {
SQLWarning warning = rows.getWarnings();
} catch (SQLRuntimeException ex) {
System.out.println(this.getClass().getName()+".doTest() : SQLRuntimeException caught as expected. [Message="+ex.getMessage()+"]");
System.out.println(this.getClass().getName()+".doTest() : TEST PASSED ");
return;
}
interface I_Query006 extends BaseQuery {
@Select(sql="SELECT firstName, lastName, id, age from dataset003 where lastName=?1")
DataSet<PersonInfo> getPersonInfo(String str) throws SQLRuntimeException;
}
--------Sample Test/Script END----------------------
Test output:
=============
/net/koori.sfbay/onestop/jdk/1.6.0/latest/binaries/solaris-sparc
TEST_ARGS=./orcl
End of TEST_PROLOG
Calling doSetup()....
Returned from doSetup()....
Calling doTest()....
DataSet003_011.doTest() : getting Connection object....
DataSet003_011.doTest() : getting QueryObject handle(JDBC 3.0)....
DataSet003_011.doTest() : got QueryObject handle(JDBC 3.0)
DataSet003_011.doTest() : Executing @Select....
DataSet003_011.doTest() : Got Dataset. Calling DataSet.close()
DataSet003_011.doTest() : Calling DataSet.getWarnings()
Exception in thread "main" java.lang.UnsupportedOperationException: Operation not supported
at com.sun.sql.DataSetImpl.getWarnings(DataSetImpl.java:1696)
at DataSet003_011.doTest(DataSet003_011.java:98)
at DataSet003_011.main(DataSet003_011.java:165)
Specific Machine Info:
=====================
For Solaris[sparc/x86] ->
5.10 Generic sun4u sparc SUNW,Ultra-60
clearWarnings() is thowing the same exception as getWarning()