Commit 31796957 authored by terrymanu's avatar terrymanu
Browse files

for #601, use try with resource for AuthorityEnvironmentManager

parent 16befa97
Loading
Loading
Loading
Loading
+16 −16
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ public final class AuthorityEnvironmentManager {
        if (initSQLs.isEmpty()) {
            return;
        }
        Connection connection = dataSource.getConnection();
        try (Connection connection = dataSource.getConnection()) {
            for (String each : initSQLs) {
                try {
                    connection.createStatement().execute(each);
@@ -70,7 +70,7 @@ public final class AuthorityEnvironmentManager {
                    log.warn("Init SQL: " + ex.getMessage());
                }
            }    
        connection.close();
        }
    }
    
    /**
@@ -83,7 +83,7 @@ public final class AuthorityEnvironmentManager {
        if (cleanSQLs.isEmpty()) {
            return;
        }
        Connection connection = dataSource.getConnection();
        try (Connection connection = dataSource.getConnection()) {
            for (String each : cleanSQLs) {
                try {
                    connection.createStatement().execute(each);
@@ -91,6 +91,6 @@ public final class AuthorityEnvironmentManager {
                    log.warn("Clean SQL: " + ex.getMessage());
                }
            }    
        connection.close();
        }
    }
}