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 dj...@apache.org on 2007/02/21 19:44:51 UTC

svn commit: r510140 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClosedObjectTest.java

Author: djd
Date: Wed Feb 21 10:44:50 2007
New Revision: 510140

URL: http://svn.apache.org/viewvc?view=rev&rev=510140
Log:
DERBY-2324 Fix ClosedObjectTest so as to not throw NullPointerExceptions on J2ME.
Caused by returning the wrong suite when running in J2ME. Changed the baseSuite method
so that the check is a positive one for the JDBC environment, which lead to clearer
code that fixed the bug.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClosedObjectTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClosedObjectTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClosedObjectTest.java?view=diff&rev=510140&r1=510139&r2=510140
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClosedObjectTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClosedObjectTest.java Wed Feb 21 10:44:50 2007
@@ -132,22 +132,21 @@
         topSuite.addTest(dsDecorator);
         fillDataSourceSuite(dsSuite, dsDecorator);
 
-        if (JDBC.vmSupportsJSR169()) {
-            // JSR169 doesn't support ConnectionPoolDataSource and XADataSource
-            return dsSuite;
-        }
-
-        TestSuite poolSuite = new TestSuite(
-                "ClosedObjectTest ConnectionPoolDataSource");
-        PoolDataSourceDecorator poolDecorator =
-            new PoolDataSourceDecorator(poolSuite);
-        topSuite.addTest(poolDecorator);
-        fillDataSourceSuite(poolSuite, poolDecorator);
-
-        TestSuite xaSuite = new TestSuite("ClosedObjectTest XA");
-        XADataSourceDecorator xaDecorator = new XADataSourceDecorator(xaSuite);
-        topSuite.addTest(xaDecorator);
-        fillDataSourceSuite(xaSuite, xaDecorator);
+        // JDBC 3 required for ConnectionPoolDataSource and XADataSource
+        if (JDBC.vmSupportsJDBC3()) {
+            
+            TestSuite poolSuite = new TestSuite(
+                    "ClosedObjectTest ConnectionPoolDataSource");
+            PoolDataSourceDecorator poolDecorator =
+                new PoolDataSourceDecorator(poolSuite);
+            topSuite.addTest(poolDecorator);
+            fillDataSourceSuite(poolSuite, poolDecorator);
+    
+            TestSuite xaSuite = new TestSuite("ClosedObjectTest XA");
+            XADataSourceDecorator xaDecorator = new XADataSourceDecorator(xaSuite);
+            topSuite.addTest(xaDecorator);
+            fillDataSourceSuite(xaSuite, xaDecorator);
+        }
 
         return topSuite;
     }
@@ -682,7 +681,7 @@
          * @exception SQLException if an error occurs
          */
         public final void setUp() throws SQLException {
-            connection_ = newConnection();
+             connection_ = newConnection();
         }
 
         /**