Path normalization breaks classpath-relative paths with a custom ResourceAccessor #5878
Open
2 tasks done
Labels
Milestone
Search first
Description
I am trying again to upgrade Bootique.io framework to Liquibase 4.x from 3.x. An earlier issue #3105 was fixed in LB 4.17, and helped us to move forward. However, there are still a few places where the base path of a resource is altered, so the relative resources can not be properly resolved inside a custom ResourceAccessor. The culprit is stripping the
classpath:
prefix during path normalization. So this change toDatabaseChangeLog.normalizePath(..)
fixes everything for me:But I suspect such a change may break things elsewhere, so not sending a PR just yet 😀 Instead, let me point to some of the call spots for
normalizePath(..)
that resulted in broken relative resources, and maybe someone can suggest a proper solution, such as an alternative normalize method that preserves the "protocol" prefix in paths:liquibase/liquibase-standard/src/main/java/liquibase/parser/core/yaml/YamlChangeLogParser.java
Line 46 in d956d5f
liquibase/liquibase-standard/src/main/java/liquibase/parser/core/xml/AbstractChangeLogParser.java
Line 20 in d956d5f
liquibase/liquibase-standard/src/main/java/liquibase/changelog/DatabaseChangeLog.java
Line 969 in d956d5f
Steps To Reproduce
This test on branch 123 fails: https://github.com/bootique/bootique-jdbc/blob/123/bootique-jdbc-junit5-derby/src/test/java/io/bootique/jdbc/junit5/derby/DerbyTester_Liquibase_RelativeIT.java
Expected/Desired Behavior
The framework code setting
DatabaseChangeLog.physicalFilePath
(either via constructor or setter) should not strip an optional "protocol" (such asclasspath:
) from the path. This will allow to apply the same protocol to relative child resources.Liquibase Version
4.27.0
Database Vendor & Version
No response
Liquibase Integration
Bootique.io
Liquibase Extensions
No response
OS and/or Infrastructure Type/Provider
No response
Additional Context
No response
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: