From fbeba83b87baa1038e90d14d156c7bb8fc47fdcd Mon Sep 17 00:00:00 2001 From: Stefan Guilhen Date: Fri, 2 Feb 2024 12:18:52 -0300 Subject: [PATCH] Upgrade liquibase to version 4.25.1 Closes #26570 Signed-off-by: Stefan Guilhen --- .../liquibase/conn/DefaultLiquibaseConnectionProvider.java | 3 +++ .../jpa/updater/liquibase/lock/CustomLockService.java | 6 +++--- pom.xml | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/conn/DefaultLiquibaseConnectionProvider.java b/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/conn/DefaultLiquibaseConnectionProvider.java index 0cd6c0bac1..27ce972b27 100644 --- a/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/conn/DefaultLiquibaseConnectionProvider.java +++ b/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/conn/DefaultLiquibaseConnectionProvider.java @@ -19,6 +19,8 @@ package org.keycloak.connections.jpa.updater.liquibase.conn; import liquibase.Liquibase; import liquibase.Scope; +import liquibase.ScopeManager; +import liquibase.ThreadLocalScopeManager; import liquibase.database.AbstractJdbcDatabase; import liquibase.database.Database; import liquibase.database.DatabaseFactory; @@ -72,6 +74,7 @@ public class DefaultLiquibaseConnectionProvider implements LiquibaseConnectionPr ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); + Scope.setScopeManager(new ThreadLocalScopeManager()); Scope.getCurrentScope(); } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); diff --git a/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/lock/CustomLockService.java b/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/lock/CustomLockService.java index 1b52634a05..c750ea98ef 100644 --- a/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/lock/CustomLockService.java +++ b/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/lock/CustomLockService.java @@ -60,8 +60,8 @@ public class CustomLockService extends StandardLockService { private static final Logger log = Logger.getLogger(CustomLockService.class); @Override - protected boolean hasDatabaseChangeLogLockTable() throws DatabaseException { - boolean originalReturnValue = super.hasDatabaseChangeLogLockTable(); + protected boolean isDatabaseChangeLogLockTableCreated() throws DatabaseException { + boolean originalReturnValue = super.isDatabaseChangeLogLockTableCreated(); if (originalReturnValue && database.getConnection().getDatabaseProductName().equals("H2")) { /* Liquibase only checks that the table exists. On the H2 database, creation of a table with a primary key is not atomic, and the primary key might not be visible yet. The primary key would be needed to prevent inserting the data into the table @@ -98,7 +98,7 @@ public class CustomLockService extends StandardLockService { public void init() throws DatabaseException { Executor executor = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor(LiquibaseConstants.JDBC_EXECUTOR, database); - if (!hasDatabaseChangeLogLockTable()) { + if (!isDatabaseChangeLogLockTableCreated()) { try { if (log.isTraceEnabled()) { diff --git a/pom.xml b/pom.xml index 60a97aa679..0243d3829e 100644 --- a/pom.xml +++ b/pom.xml @@ -147,7 +147,7 @@ 2.3.32 ${jetty94.version} - 4.23.2 + 4.25.1 4.2.0 7.1.0 1.0.2.Final