This is an automated email from the ASF dual-hosted git repository.

HTHou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new b727c66eec4 Reclaim the statement variable to avoid executing stale 
statements in the subsequent new test case (#18001)
b727c66eec4 is described below

commit b727c66eec4ee0b8ddd741bf9ca77d6c6110d817
Author: libo <[email protected]>
AuthorDate: Tue Jun 23 10:30:32 2026 +0800

    Reclaim the statement variable to avoid executing stale statements in the 
subsequent new test case (#18001)
    
    * Reclaim the statement variable to avoid executing stale statements in the 
subsequent new test case.
    
    * Don't affect the connection closing any more
    
    * Fix
---
 .../test/java/org/apache/iotdb/db/it/utils/TestUtils.java    | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/utils/TestUtils.java 
b/integration-test/src/test/java/org/apache/iotdb/db/it/utils/TestUtils.java
index 93f14dc572b..11cc0654f90 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/utils/TestUtils.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/utils/TestUtils.java
@@ -1205,14 +1205,24 @@ public class TestUtils {
         }
         return true;
       } catch (SQLException e) {
+        if (statement != null) {
+          try {
+            statement.close();
+          } catch (Exception ex) {
+            // ignore
+          } finally {
+            statement = null;
+          }
+        }
         // the default connection should be closed by the upper level
         // while the local connection should be closed here
         if (connectionToUse == localConnection && localConnection != null) {
           try {
             localConnection.close();
-            localConnection = null;
           } catch (SQLException ex) {
             // ignore
+          } finally {
+            localConnection = null;
           }
         }
         connectionToUse = null;

Reply via email to