You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by be...@apache.org on 2006/04/07 12:15:21 UTC

svn commit: r392236 - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/ testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/ testing/org/apache/de...

Author: bernt
Date: Fri Apr  7 03:15:17 2006
New Revision: 392236

URL: http://svn.apache.org/viewcvs?rev=392236&view=rev
Log:
 DERBY-1177 updateObject with null as argument causes network driver to fail with NullPointerException

Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/UpdateXXXTest.java   (with props)
Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/CrossConverters.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/updatableResultSet.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk16/updatableResultSet.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/updatableResultSet.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/CrossConverters.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/CrossConverters.java?rev=392236&r1=392235&r2=392236&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/CrossConverters.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/CrossConverters.java Fri Apr  7 03:15:17 2006
@@ -807,7 +807,9 @@
     // The Java compiler uses static binding, so we can't rely on the strongly
     // typed setObject() methods above for each of the Java Object instance types.
     final Object setObject(int targetType, Object source) throws SqlException {
-        if (source instanceof Boolean) {
+        if (source == null) {
+            return null;
+        } else if (source instanceof Boolean) {
             return setObject(targetType, ((Boolean) source).booleanValue());
         } else if (source instanceof Integer) {
             return setObject(targetType, ((Integer) source).intValue());

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java?rev=392236&r1=392235&r2=392236&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java Fri Apr  7 03:15:17 2006
@@ -1413,7 +1413,6 @@
     // indicates column has been updated, then column is updated to null.
     private boolean wasNullSensitiveUpdate(int column) {
         return
-                resultSetType_ == java.sql.ResultSet.TYPE_SCROLL_SENSITIVE &&
                 updatedColumns_ != null &&
                 updatedColumns_[column - 1] == null &&
                 columnUpdated_[column - 1];

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/updatableResultSet.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/updatableResultSet.out?rev=392236&r1=392235&r2=392236&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/updatableResultSet.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/updatableResultSet.out Fri Apr  7 03:15:17 2006
@@ -2226,9 +2226,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is INTEGER
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2273,9 +2271,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is BIGINT
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2320,9 +2316,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is DECIMAL(10,5)
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2367,9 +2361,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is REAL
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2412,9 +2404,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is DOUBLE
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2457,9 +2447,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is CHAR(60)
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2494,9 +2482,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is VARCHAR(60)
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2531,9 +2517,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is LONG VARCHAR
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2568,9 +2552,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is CHAR(2) FOR BIT DATA
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'BINARY'.
@@ -2627,9 +2609,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'BINARY'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is VARCHAR(2) FOR BIT DATA
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'VARBINARY'.
@@ -2686,9 +2666,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'VARBINARY'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is LONG VARCHAR FOR BIT DATA
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'LONGVARBINARY'.
@@ -2743,9 +2721,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'LONGVARBINARY'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is CLOB(1k)
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'CLOB'.
@@ -2800,9 +2776,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'CLOB'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is DATE
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'DATE'.
@@ -2857,9 +2831,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'DATE'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is TIME
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'TIME'.
@@ -2914,9 +2886,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'TIME'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is TIMESTAMP
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'TIMESTAMP'.
@@ -2971,9 +2941,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'TIMESTAMP'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is BLOB(1k)
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'BLOB'.
@@ -3028,9 +2996,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'BLOB'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Positive Test23 - Test cancelRowUpdates after updateXXX methods on all the supported sql datatypes
   updateShort and then cancelRowUpdates
   updateInt and then cancelRowUpdates

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk16/updatableResultSet.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk16/updatableResultSet.out?rev=392236&r1=392235&r2=392236&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk16/updatableResultSet.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk16/updatableResultSet.out Fri Apr  7 03:15:17 2006
@@ -2226,9 +2226,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is INTEGER
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2273,9 +2271,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is BIGINT
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2320,9 +2316,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is DECIMAL(10,5)
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2367,9 +2361,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is REAL
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2412,9 +2404,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is DOUBLE
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2457,9 +2447,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is CHAR(60)
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2494,9 +2482,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is VARCHAR(60)
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2531,9 +2517,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is LONG VARCHAR
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2568,9 +2552,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is CHAR(2) FOR BIT DATA
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'BINARY'.
@@ -2627,9 +2609,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'BINARY'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is VARCHAR(2) FOR BIT DATA
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'VARBINARY'.
@@ -2686,9 +2666,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'VARBINARY'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is LONG VARCHAR FOR BIT DATA
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'LONGVARBINARY'.
@@ -2743,9 +2721,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'LONGVARBINARY'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is CLOB(1k)
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'CLOB'.
@@ -2800,9 +2776,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'CLOB'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is DATE
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'DATE'.
@@ -2857,9 +2831,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'DATE'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is TIME
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'TIME'.
@@ -2914,9 +2886,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'TIME'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is TIMESTAMP
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'TIMESTAMP'.
@@ -2971,9 +2941,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'TIMESTAMP'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is BLOB(1k)
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'BLOB'.
@@ -3028,9 +2996,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'BLOB'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Positive Test23 - Test cancelRowUpdates after updateXXX methods on all the supported sql datatypes
   updateShort and then cancelRowUpdates
   updateInt and then cancelRowUpdates

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/updatableResultSet.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/updatableResultSet.out?rev=392236&r1=392235&r2=392236&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/updatableResultSet.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/updatableResultSet.out Fri Apr  7 03:15:17 2006
@@ -2074,9 +2074,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is INTEGER
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2113,9 +2111,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is BIGINT
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2152,9 +2148,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is DECIMAL(10,5)
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2191,9 +2185,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is REAL
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2228,9 +2220,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is DOUBLE
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2265,9 +2255,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is CHAR(60)
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2296,9 +2284,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is VARCHAR(60)
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2327,9 +2313,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is LONG VARCHAR
   updateObject with column position & Short object as parameters
   updateObject with column name & Short object as parameters
@@ -2358,9 +2342,7 @@
   updateObject with column position & Boolean object as parameters
   updateObject with column name & Boolean object as parameters
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is CHAR(2) FOR BIT DATA
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'BINARY'.
@@ -2409,9 +2391,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'BINARY'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is VARCHAR(2) FOR BIT DATA
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'VARBINARY'.
@@ -2460,9 +2440,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'VARBINARY'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is LONG VARCHAR FOR BIT DATA
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'LONGVARBINARY'.
@@ -2511,9 +2489,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'LONGVARBINARY'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is CLOB(1k)
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'CLOB'.
@@ -2562,9 +2538,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'CLOB'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is DATE
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'DATE'.
@@ -2611,9 +2585,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'DATE'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is TIME
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'TIME'.
@@ -2660,9 +2632,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'TIME'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is TIMESTAMP
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'TIMESTAMP'.
@@ -2709,9 +2679,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'TIMESTAMP'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Next datatype to test is BLOB(1k)
   updateObject with column position & Short object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'BLOB'.
@@ -2760,9 +2728,7 @@
   updateObject with column name & Boolean object as parameters
     Got expected exception : An attempt was made to put a data value of type 'byte' into a data value of type 'BLOB'.
   updateObject with column position & null as parameters
-   Got expected exception:null
   updateObject with column name & null as parameters
-   Got expected exception:null
 Positive Test23 - Test cancelRowUpdates after updateXXX methods on all the supported sql datatypes
   updateShort and then cancelRowUpdates
   updateInt and then cancelRowUpdates

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude?rev=392236&r1=392235&r2=392236&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude Fri Apr  7 03:15:17 2006
@@ -35,10 +35,10 @@
 # excluding jdbcapi/derbyStress.java - jcc runs out of memory with this test
 jdbcapi/derbyStress.java
 largedata/LobLimits.java
-# These next four fail with an error saying that a null username is not 
-# supported. When fixing the username issue, they will fail since the
+# These next five tests fail since the
 # db2 driver produces statements which Derby cannot compile in 
 # ResultSet.updateRow()
+jdbcapi/UpdateXXXTest.junit
 jdbcapi/SURQueryMixTest.junit
 jdbcapi/SURTest.junit
 jdbcapi/ConcurrencyTest.junit

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall?rev=392236&r1=392235&r2=392236&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall Fri Apr  7 03:15:17 2006
@@ -21,5 +21,6 @@
 jdbcapi/testRelative.java
 jdbcapi/rsgetXXXcolumnNames.java
 jdbcapi/Stream.java
+jdbcapi/UpdateXXXTest.junit
 jdbcapi/SURQueryMixTest.junit
 jdbcapi/SURTest.junit

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/UpdateXXXTest.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/UpdateXXXTest.java?rev=392236&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/UpdateXXXTest.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/UpdateXXXTest.java Fri Apr  7 03:15:17 2006
@@ -0,0 +1,347 @@
+/*
+ *
+ * Derby - Class UpdateXXXTest
+ *
+ * Copyright 2006 The Apache Software Foundation or its
+ * licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ */
+package org.apache.derbyTesting.functionTests.tests.jdbcapi;
+
+import org.apache.derbyTesting.functionTests.util.BaseJDBCTestCase;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.PreparedStatement;
+import java.sql.Statement;
+import java.sql.Connection;
+
+import java.math.BigDecimal;
+
+
+/**
+ * Tests updateXXX() methods on updatable resultsets.
+ * This is done by creating a table which has n columns with
+ * different SQL types. Then there is one testcase for each
+ * updateXXX method, which calls updateXXX on all columns.
+ */
+final public class UpdateXXXTest extends BaseJDBCTestCase
+{
+    /**
+     * Constructor
+     * @param name name of testcase. Should be the name of test method.
+     */
+    public UpdateXXXTest(final String name) {
+        super(name);
+    }
+
+    /**
+     * The setup creates a Connection to the database, and also
+     * creates a table with one row. Then it creates an updatable
+     * ResultSet which is positioned on the row.
+     * @exception Exception any exception will cause test to fail with error.
+     */
+    public void setUp()
+        throws Exception
+    {
+        try {
+            con = getConnection();
+            con.setAutoCommit(false);
+            
+            Statement stmt = con.createStatement();
+            String createTableString = "CREATE TABLE " + TABLE_NAME + " (" +
+                "F01 SMALLINT," + 
+                "F02 INTEGER," +
+                "F03 BIGINT," + 
+                "F04 REAL," +
+                "F05 FLOAT," +
+                "F06 DOUBLE," +
+                "F07 DECIMAL," +
+                "F08 NUMERIC," +
+                "F09 CHAR(100)," +
+                "F10 VARCHAR(256) )";
+            println(createTableString);
+            stmt.executeUpdate(createTableString);
+            PreparedStatement ps = con.prepareStatement
+                ("insert into " + TABLE_NAME + " values(?,?,?,?,?,?,?,?,?,?)");
+            
+            ps.setShort(1, (short) 1);
+            ps.setInt(2, 1);
+            ps.setLong(3, 1L);
+            ps.setFloat(4, 1.0f);
+            ps.setDouble(5, 1.0);
+            ps.setDouble(6, 1.0);
+            ps.setBigDecimal(7, BigDecimal.valueOf(1L));
+            ps.setBigDecimal(8, BigDecimal.valueOf(1L));
+            ps.setString(9, "1");
+            ps.setString(10, "1");
+            ps.executeUpdate();
+            
+            rs = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, 
+                                     ResultSet.CONCUR_UPDATABLE).
+                executeQuery(SELECT_STMT);
+            rs.next();
+        } catch (SQLException e) {
+            con.rollback();
+            throw e;
+        }
+    }
+
+    /**
+     * Teardown test.
+     * Rollback connection and close it.
+     * @exception Exceptions causes the test to fail with error
+     */
+    public void tearDown() 
+        throws Exception 
+    {
+        try { 
+            con.rollback();
+            con.close();
+        } catch (SQLException e) {
+            printStackTrace(e);
+        }      
+    }
+        
+    /**
+     * Tests calling updateString on all columns of the row.
+     * @exception SQLException database access error. Causes test to 
+     *                         fail with an error.
+     */
+    public void testUpdateString() 
+        throws SQLException
+    {
+        for (int i = 1; i <= COLUMNS; i++) {
+            rs.updateString(i, "2");
+            assertEquals("Expected rs.getDouble(" + i + 
+                         ") to match updated value", 2, (int) rs.getDouble(i));
+        }
+        rs.updateRow();
+        checkColumnsAreUpdated();
+        
+    }
+
+    /**
+     * Tests calling updateInt on all columns of the row.
+     * @exception SQLException database access error. Causes test to 
+     *                         fail with an error.
+     */
+    public void testUpdateInt() 
+        throws SQLException
+    {
+        for (int i = 1; i <= COLUMNS; i++) {
+            rs.updateInt(i, 2);
+            assertEquals("Expected rs.getInt(" + i + 
+                         ") to match updated value", 2, rs.getInt(i));
+        }
+        rs.updateRow();
+        checkColumnsAreUpdated();
+    }
+
+    /**
+     * Tests calling updateLong on all columns of the row.
+     * @exception SQLException database access error. Causes test to 
+     *                         fail with an error.
+     */
+    public void testUpdateLong() 
+        throws SQLException
+    {
+        for (int i = 1; i <= COLUMNS; i++) {
+            rs.updateLong(i, 2L);
+            assertEquals("Expected rs.getLong(" + i + 
+                         ") to match updated value", 2L, rs.getLong(i));
+        }
+        rs.updateRow();
+        checkColumnsAreUpdated();
+    }
+
+    /**
+     * Tests calling updateShort on all columns of the row.
+     * @exception SQLException database access error. Causes test to 
+     *                         fail with an error.
+     */
+    public void testUpdateShort() 
+        throws SQLException
+    {
+        for (int i = 1; i <= COLUMNS; i++) {
+            rs.updateShort(i, (short) 2);
+            assertEquals("Expected rs.getShort(" + i + 
+                         ") to match updated value", 2, (int) rs.getShort(i));
+        }
+        rs.updateRow();
+        checkColumnsAreUpdated();
+    }
+    
+    /**
+     * Tests calling updateFloat on all columns of the row.
+     * @exception SQLException database access error. Causes test to 
+     *                         fail with an error.
+     */
+    public void testUpdateFloat() 
+        throws SQLException
+    {
+        for (int i = 1; i <= COLUMNS; i++) {
+            rs.updateFloat(i, 2.0f);
+            assertEquals("Expected rs.getFloat(" + i + 
+                         ") to match updated value", 2, (int) rs.getFloat(i));
+        }
+        rs.updateRow();
+        checkColumnsAreUpdated();
+    }
+    
+    /**
+     * Tests calling updateDouble on all columns of the row.
+     * @exception SQLException database access error. Causes test to 
+     *                         fail with an error.
+     */
+    public void testUpdateDouble() 
+        throws SQLException
+    {
+        for (int i = 1; i <= COLUMNS; i++) {
+            rs.updateDouble(i, 2.0);
+            assertEquals("Expected rs.getDouble(" + i + 
+                         ") to match updated value", 2, (int) rs.getDouble(i));
+        }
+        rs.updateRow();
+        checkColumnsAreUpdated();
+    }
+
+    /**
+     * Tests calling update on all columns of the row.
+     * @exception SQLException database access error. Causes test to 
+     *                         fail with an error.
+     */
+    public void testUpdateBigDecimal() 
+        throws SQLException
+    {
+        for (int i = 1; i <= COLUMNS; i++) {
+            rs.updateBigDecimal(i, BigDecimal.valueOf(2L));
+            assertEquals("Expected rs.getBigDecimal(" + i + 
+                         ") to match updated value", 2, 
+                         rs.getBigDecimal(i).intValue());
+        }
+        rs.updateRow();
+        checkColumnsAreUpdated();
+    }
+    
+    /**
+     * Tests calling updateObject with a null value on all columns.
+     * @exception SQLException database access error. Causes test to 
+     *                         fail with an error.
+     */
+    public void testUpdateObjectWithNull() 
+        throws SQLException
+    {
+        Object value = null;
+        
+        for (int i = 1; i <= COLUMNS; i++) {
+            rs.updateObject(i, value);
+            assertNull("Expected rs.getObject(" + i + ") to be null", 
+                       rs.getObject(i));
+            assertTrue("Expected rs.wasNull() to return true",
+                       rs.wasNull());
+        }
+        rs.updateRow();
+        checkColumnsAreNull();
+    }
+
+    /**
+     * Tests calling setNull on all columns
+     * @exception SQLException database access error. Causes test to 
+     *                         fail with an error.
+     */
+    public void testUpdateNull() 
+        throws SQLException
+    {
+        for (int i = 1; i <= COLUMNS; i++) {
+            rs.updateNull(i);
+            assertNull("Expected rs.getObject(" + i + ") to be null", 
+                       rs.getObject(i));
+            assertTrue("Expected rs.wasNull() to return true",
+                       rs.wasNull());
+        }
+        rs.updateRow();
+        checkColumnsAreNull();
+    }
+
+    /**
+     * Checks that the columns in the row are all SQL null.
+     * @exception SQLException database access error. Causes test to 
+     *                         fail with an error.
+     */
+    private void checkColumnsAreNull() 
+        throws SQLException
+    {
+        rs.close();
+        
+        rs = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, 
+                                 ResultSet.CONCUR_READ_ONLY).
+            executeQuery(SELECT_STMT);
+        
+        rs.next();
+        
+        for (int i = 1; i <= COLUMNS; i++) {
+            assertNull("Expected column " + i + " to be null", 
+                       rs.getObject(i));
+            assertTrue("Expected wasNull() after reading column " + i +
+                       " to be true when data is SQL Null on column", 
+                       rs.wasNull());
+        }
+    }
+
+    /**
+     * Checks that the columns in the row are updated in the database.
+     * Using a new ResultSet to do this check.
+     * @exception SQLException database access error. Causes test to 
+     *                         fail with an error.
+     */
+    private void checkColumnsAreUpdated() 
+        throws SQLException
+    {
+        rs.close();
+        
+        rs = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, 
+                                 ResultSet.CONCUR_READ_ONLY).
+            executeQuery(SELECT_STMT);
+        
+        rs.next();
+        for (int i = 1; i <= COLUMNS; i++) {
+            int expectedVal = 2;
+            
+            // Since rs.getInt(i) on CHAR/VARCHAR columns with value 2.0 gives:
+            // "ERROR 22018: Invalid character string format for type int"
+            // we use getDouble(i). We cast it to int, because there is not
+            // assertEquals(..) methods which takes double.
+            int actualVal = (int) rs.getDouble(i); 
+            assertEquals("Unexpected value from rs.getDouble( + " + i + ")",
+                         expectedVal, actualVal);
+        }
+    }
+    
+    /* Updatable ResultSet */
+    private ResultSet rs = null;
+    
+    /* Connection */
+    private Connection con = null;
+    
+    /* Table name */
+    private static final String TABLE_NAME = "MultiTypeTable";
+
+    /* SQL String for the SELECT statement */
+    private static final  String SELECT_STMT = 
+        "SELECT * FROM " + TABLE_NAME;
+                             
+    /* Number of columns in table */
+    private static final int COLUMNS = 10;
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/UpdateXXXTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java?rev=392236&r1=392235&r2=392236&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java Fri Apr  7 03:15:17 2006
@@ -1956,14 +1956,9 @@
 									rs.updateObject(sqlType, null);
 								else //test by passing column name
 									rs.updateObject(ColumnNames[sqlType-1], null);
-								} catch (Throwable e) {
-								if (TestUtil.isNetFramework()) {
-									System.out.println("   Got expected exception:" + e.getMessage());
-									continue;
-								} else {
+								} catch (Throwable e) {							
 									System.out.println("   Got UNexpected exception:" + e.getMessage());
 									return;
-								}
 								}
 							} else if (updateXXXName == 20 || updateXXXName == 21) //since Derby does not support Array, Ref datatype, this is a no-op
 									continue;