Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Bump liquibase-core from 4.16.1 to 4.17.2 #427

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
import liquibase.ext.TimeoutLockService;
import liquibase.lockservice.LockServiceFactory;
import liquibase.resource.ClassLoaderResourceAccessor;
import liquibase.resource.InputStreamList;
import liquibase.resource.Resource;
import liquibase.resource.URIResource;
import se.fortnox.reactivewizard.db.DbDriver;

import javax.inject.Inject;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
Expand Down Expand Up @@ -56,9 +56,7 @@ public LiquibaseMigrate(LiquibaseConfig liquibaseConfig) throws LiquibaseExcepti
while (resources.hasMoreElements()) {
URL url = resources.nextElement();
String file = url.toExternalForm();
int jarFileSep = file.lastIndexOf('!');
String loggedFileName = file.substring(jarFileSep + 1);
Liquibase liquibase = new Liquibase(loggedFileName, new UrlAwareClassLoaderResourceAccessor(file), conn);
Liquibase liquibase = new Liquibase(file, new UrlAwareClassLoaderResourceAccessor(file), conn);
liquibase.getDatabase().setDefaultSchemaName(liquibaseConfig.getSchema());

liquibaseList.add(liquibase);
Expand Down Expand Up @@ -152,34 +150,30 @@ void exit() {
System.exit(0);
}

class UrlAwareClassLoaderResourceAccessor extends ClassLoaderResourceAccessor {
static class UrlAwareClassLoaderResourceAccessor extends ClassLoaderResourceAccessor {
private final String realFileName;

public UrlAwareClassLoaderResourceAccessor(String realFileName) {
this.realFileName = realFileName;
}

@Override
public InputStreamList openStreams(String relativeTo, String path) throws IOException {
public Resource get(String path) throws IOException {
if (realFileName.endsWith(path)) {
path = realFileName;
}

if (path.startsWith("file:") || path.startsWith("jar:file:")) {
URL url = new URL(path);
InputStream resourceAsStream = url.openStream();
InputStreamList inputStreamList = new InputStreamList();
URI uri;
try {
uri = url.toURI();
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
inputStreamList.add(uri, resourceAsStream);

return inputStreamList;
return new URIResource(path, uri);
}
return super.openStreams(relativeTo, path);
return super.get(path);
}
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<maven-checkstyle-plugin.version>3.2.0</maven-checkstyle-plugin.version>
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
<checkstyle.version>10.4</checkstyle.version>
<liquibase-core.version>4.16.1</liquibase-core.version>
<liquibase-core.version>4.17.2</liquibase-core.version>
<liquibase-slf4j.version>4.1.0</liquibase-slf4j.version>
<javax.inject.version>1</javax.inject.version>
<metrics-core.version>4.2.12</metrics-core.version>
Expand Down