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 km...@apache.org on 2008/01/18 22:15:56 UTC

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

Author: kmarsden
Date: Fri Jan 18 13:15:55 2008
New Revision: 613275

URL: http://svn.apache.org/viewvc?rev=613275&view=rev
Log:
DERBY-3323  ComparisonFailure in derbyStress

The test intentionally does not close ResultSets to test for a leak, but this 
was causing an error dropping the table. Changed the test to close the last ResultSet and gc() to avoid the drop table error.


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

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress.java?rev=613275&r1=613274&r2=613275&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/derbyStress.java Fri Jan 18 13:15:55 2008
@@ -150,10 +150,11 @@
           ps.setString(1,"hello");
           ps.executeUpdate();
           ps.close();
+          ResultSet rs = null;
           for (int i = 0; i < 2000; i++)
           {
                   s = conn.createStatement();
-                  ResultSet rs = s.executeQuery("SELECT * from tab");
+                  rs = s.executeQuery("SELECT * from tab");
                   // drain the resultset
                   while (rs.next());
                   // With DERBY-3316, If I don't explicitly close the resultset or 
@@ -161,6 +162,11 @@
                   //rs.close();
                   //s.close();
           }    
+          // close the final ResultSet and gc() so we won't have a 
+          // ResultSet reference when we try to drop the table.
+          rs.close();
+          rs = null;
+          System.gc();
           s = conn.createStatement();
           s.executeUpdate("DROP TABLE TAB");
           s.close();