db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1431945 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangProcedureTest.java
Date Fri, 11 Jan 2013 09:22:14 GMT
Author: kahatlen
Date: Fri Jan 11 09:22:14 2013
New Revision: 1431945

URL: http://svn.apache.org/viewvc?rev=1431945&view=rev
Log:
DERBY-6038: Intermittent failure in LangProcedureTest: cannot drop table because of open ResultSet

Explicitly close the non-dynamic result set in the regression test case
for DERBY-3304. Also update the comments to reflect that DERBY-3304 only
affected the internal CallStatementResultSet and its dynamic result sets.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangProcedureTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangProcedureTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangProcedureTest.java?rev=1431945&r1=1431944&r2=1431945&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangProcedureTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangProcedureTest.java
Fri Jan 11 09:22:14 2013
@@ -955,7 +955,7 @@ public class LangProcedureTest extends B
             // it with parameters such that insert will fail because of
             // duplicate key. The procedure also has couple select statements
             // The exception thrown for duplicate key should close the
-            // resultsets associated with select statement and we should be
+            // dynamic result sets in the procedure, and we should be
             // able to drop the tables used in the select queries without
             // running into locking issues.
             s.execute(
@@ -1362,8 +1362,8 @@ public class LangProcedureTest extends B
      * A test case for DERBY-3304. The procedure is attempting to insert a
      * duplicate key into a table which causes an internal rollback (vs a
      * user-initiated rollback). This internal rollback should close the
-     * internal resultset associated with Java procedure along with closing
-     * the resulsets for 2 SELECT queries.
+     * internal CallStatementResultSet associated with the Java procedure
+     * and the dynamic result set.
      * 
      * @param p1
      * @param p2
@@ -1388,7 +1388,15 @@ public class LangProcedureTest extends B
         PreparedStatement ps1 = conn.prepareStatement(
         		"select * from dellater3 where c31 = ?");
         ps1.setInt(1, p1);
-        ps1.executeQuery();
+        ResultSet rs = ps1.executeQuery();
+
+        // DERBY-6038: When the procedure fails because of duplicate key
+        // exception below, all dynamic results set will be closed. Other
+        // open result sets will stay open until they have been garbage
+        // collected and finalized. Their staying open may cause problems
+        // later in the test, so close non-dynamic result sets before
+        // returning.
+        rs.close();
 
         // Depending on the value of p1, following may throw duplicate key
         // exception. If that happens, both the dynamic resultset and local



Mime
View raw message