From 0c8754c13015783883f2ba67b2640cec7a09b9af Mon Sep 17 00:00:00 2001 From: maverickstuder Date: Tue, 19 Mar 2024 12:27:19 +0100 Subject: [PATCH] fixed checkstyle --- .../liquibase/TenantMongoLiquibaseExecutor.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/knecon/fforesight/mongo/database/commons/liquibase/TenantMongoLiquibaseExecutor.java b/src/main/java/com/knecon/fforesight/mongo/database/commons/liquibase/TenantMongoLiquibaseExecutor.java index 907c4aa..6eb2100 100644 --- a/src/main/java/com/knecon/fforesight/mongo/database/commons/liquibase/TenantMongoLiquibaseExecutor.java +++ b/src/main/java/com/knecon/fforesight/mongo/database/commons/liquibase/TenantMongoLiquibaseExecutor.java @@ -58,11 +58,12 @@ public class TenantMongoLiquibaseExecutor implements InitializingBean { try (MongoLiquibaseDatabase database = (MongoLiquibaseDatabase) DatabaseFactory.getInstance() .openDatabase(mongoUrl, mongoDBConnection.getUsername(), encryptionService.decrypt(mongoDBConnection.getPassword()), null, null)) { - Liquibase liquibase = new Liquibase(tenantLiquibaseProperties.getChangeLog(), new ClassLoaderResourceAccessor(), database); - Contexts contexts = new Contexts(tenantLiquibaseProperties.getContexts()); - List changeSetsList = liquibase.listUnrunChangeSets(contexts, null); - if (!changeSetsList.isEmpty()) { - liquibase.update(contexts); + try (Liquibase liquibase = new Liquibase(tenantLiquibaseProperties.getChangeLog(), new ClassLoaderResourceAccessor(), database)) { + Contexts contexts = new Contexts(tenantLiquibaseProperties.getContexts()); + List changeSetsList = liquibase.listUnrunChangeSets(contexts, null); + if (!changeSetsList.isEmpty()) { + liquibase.update(contexts); + } } } catch (Exception e) {