Bläddra i källkod

!213 bugfix #I7WNDA close方法遵循先打开的后关闭原则
Merge pull request !213 from 与或非/issues/I7WNDA

铂赛东 1 år sedan
förälder
incheckning
6063b7a817

+ 6 - 6
liteflow-rule-plugin/liteflow-rule-sql/src/main/java/com/yomahub/liteflow/parser/sql/util/LiteFlowJdbcUtil.java

@@ -91,10 +91,10 @@ public class LiteFlowJdbcUtil {
      * @param rs   rs
      */
     public static void close(Connection conn, PreparedStatement stmt, ResultSet rs) {
-        // 关闭连接
-        if (conn != null) {
+        // 关闭结果集
+        if (rs != null) {
             try {
-                conn.close();
+                rs.close();
             } catch (SQLException e) {
                 throw new ELSQLException(e.getMessage());
             }
@@ -107,10 +107,10 @@ public class LiteFlowJdbcUtil {
                 throw new ELSQLException(e.getMessage());
             }
         }
-        // 关闭结果集
-        if (rs != null) {
+        // 关闭连接
+        if (conn != null) {
             try {
-                rs.close();
+                conn.close();
             } catch (SQLException e) {
                 throw new ELSQLException(e.getMessage());
             }