db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r544861 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
Date Wed, 06 Jun 2007 14:56:36 GMT
Author: kahatlen
Date: Wed Jun  6 07:56:35 2007
New Revision: 544861

URL: http://svn.apache.org/viewvc?view=rev&rev=544861
Log:
DERBY-2768: Do cleanup (closing stmts., conns.) on failures in
jdbcapi/BlobClob4BlobTest.java

jdbcapi/BlobClob4BlobTest.java should cleanup when detecting failures
['fail("FAIL - ....");']. When failures occur, as when doing
compatibility testing for Blob/Clob locator support, other failures
will occur later. Missing cleanup makes subsequent tests fail.

Contributed by Ole Solberg.

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

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java?view=diff&rev=544861&r1=544860&r2=544861
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
Wed Jun  6 07:56:35 2007
@@ -642,6 +642,10 @@
         while (rs.next()) {
             try {
                 Clob clob = rs.getClob(1);
+
+                rs.close(); // Cleanup on fail
+                stmt.close();
+
                 fail("FAIL - getClob on column type int should throw " +
                         "an exception");
             } catch (SQLException se) {
@@ -673,6 +677,10 @@
                     ps.setClob(1,clob);
                     ps.setInt(2, clobLength);
                     ps.executeUpdate();
+
+                    rs.close(); // Cleanup on fail
+                    stmt.close();
+
                     fail("FAIL - can not use setClob on int column");
                 } catch (SQLException se) {
                     checkException(LANG_DATA_TYPE_GET_MISMATCH, se);
@@ -1143,6 +1151,9 @@
         try {
             stmt2.executeUpdate(
                     "update testClob set b = b + 1 where b = 10000");
+            stmt2.close(); // Cleanup on fail
+            conn2.rollback();
+            conn2.close();
             fail("FAIL: row should be locked");
         } catch (SQLException se) {
             checkException(LOCK_TIMEOUT, se);
@@ -1199,6 +1210,9 @@
         try {
             stmt2.executeUpdate(
                     "update testClob set el = 'smurfball' where b = 1");
+            stmt2.close(); // Cleanup on fail
+            conn2.commit();
+            conn2.close();
             fail("FAIL - statement should timeout");
         } catch (SQLException se) {
             checkException(LOCK_TIMEOUT, se);
@@ -1896,12 +1910,15 @@
             // get the first column as a clob
             try {
                 Blob blob = rs.getBlob(1);
-                fail("FAIL - getBlob on int column should throw and " +
+                rs.close();
+                stmt.close();
+                fail("FAIL - getBlob on int column should throw an " +
                         "exception");
             } catch (SQLException se) {
                 checkException(LANG_DATA_TYPE_GET_MISMATCH, se);
             }
         }
+        rs.close();
         stmt.close();
         commit();
 
@@ -1926,6 +1943,9 @@
                 try {
                     ps.setBlob(1,blob);
                     ps.executeUpdate();
+                    rs.close();
+                    stmt.close();
+                    ps.close();
                     fail("FAIL - setBlob worked on INT column");
                 } catch (SQLException se) {
                     checkException(LANG_DATA_TYPE_GET_MISMATCH, se);
@@ -2163,6 +2183,9 @@
             
             stmt2.executeUpdate(
                     "update testBlob set b = b + 1 where b = 10000");
+            stmt.close();
+            stmt2.close();
+            conn2.close();
             fail("FAIL - should have gotten lock timeout");
         } catch (SQLException se) {
             checkException(LOCK_TIMEOUT, se);
@@ -2219,6 +2242,9 @@
         stmt2 = conn2.createStatement();
         try {
             stmt2.executeUpdate("update testBlob set el = null where b = 1");
+            stmt2.close();
+            stmt.close();
+            conn2.close();
             fail("FAIL - statement should timeout");
         } catch (SQLException se) {
             checkException(LOCK_TIMEOUT, se);



Mime
View raw message