Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed URIResource.resolveSibling #3354

Merged
merged 2 commits into from Oct 12, 2022
Merged

Fixed URIResource.resolveSibling #3354

merged 2 commits into from Oct 12, 2022

Conversation

nvoxland
Copy link
Contributor

Impact

  • Bug fix (non-breaking change which fixes expected existing functionality)
  • Enhancement/New feature (adds functionality without impacting existing logic)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Fixes the creation of "relative" resources based on being relative to other files.

For example, using <include path="newFile.xml" relativeToChangelogFile="true">.

The issue is only with files looked up via URLs, such as files within a jar from the classloader. It doesn't impact all ResourceAccessor implementations

Things to be aware of

  • Regular expression we were using for "strip everything after the last /" was not always working

Things to worry about

  • Nothing

@github-actions
Copy link

github-actions bot commented Oct 10, 2022

Unit Test Results

  4 668 files  ±  0    4 668 suites  ±0   38m 59s ⏱️ + 7m 58s
  4 613 tests  - 14    4 384 ✔️  - 17     229 💤 +3  0 ±0 
54 564 runs  +36  49 496 ✔️ +31  5 068 💤 +5  0 ±0 

Results for commit 40530c0. ± Comparison against base commit c9ceb05.

♻️ This comment has been updated with latest results.

@XDelphiGrl
Copy link
Contributor

Bug Description
This bug was identified during execution of test-harness tests on a Liquibase extension. Liquibase was unable to access changelogs defined with include in a root changelog when the include specified relativeToChangeLogFile=true. The error displayed was:

Unexpected error running Liquibase: java.net.MalformedURLException: no !/ in spec

Test File Structure

  • A root XML changelog referenced include changelogs in a directory relative to the root changelog. For example:
	<include file="./changelogs/baseline.mssql.sql" relativeToChangelogFile="true" />
	<include file="./changelogs/01-marketing_table.sql" relativeToChangelogFile="true" />
	<include file="./changelogs/02-CreateRole.sql" relativeToChangelogFile="true" />
	<include file="./changelogs/Release-1.0.0.sql" relativeToChangelogFile="true" />
  • The included changelog files were located in changelogs relative to the root changelog.

Test Cases

  • Verify Liquibase Springboot accesses include changelogs. PASS
  • Verify Liquibase Servelet accesses include changelogs. PASS
  • Verify Liquibase Maven accesses include changelogs. PASS
  • Verify Liquibase accesses include changelogs when changelogs are in a separate resources jar. PASS
    • Command Executed:
java -cp "internal/lib/liquibase-core.jar;lib/liquibase-resources.jar;lib/*;internal/lib/*" liquibase.integration.commandline.LiquibaseCommandLine --defaults-file C:\Users\erz\work\liquibase.properties update --changelog-file cyclopsbi.xml

The liquibase-resources.jar contains the root and included changelogs; I created this jar and put it in the liquibase/lib.


Test Environment
Core: fix-uriresource-resolve/4975/40530c (Build 4975)
Commercial: master/2291/d6d8f6/
MSSQL 2017

Copy link
Contributor

@XDelphiGrl XDelphiGrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix addresses a regular expression that prevented certain URI resource accessors to fail to find included changelogs.

  • Failing extension test harness execution is fixed by this PR.
  • Manual testing completed for Liquibase SpringBoot, Liquibase Maven, Liquibase Servlet and calling Liquibase with changelog resources in a separate jar.
  • No additional testing required.

APPROVED

@nvoxland nvoxland merged commit 00ee3f9 into master Oct 12, 2022
@nvoxland nvoxland deleted the fix-uriresource-resolve branch October 12, 2022 17:01
@kataggart kataggart added this to the 1NEXT milestone Oct 12, 2022
@nvoxland nvoxland linked an issue Oct 13, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Changelogs that worked with 3.10 are failing on 4.17
4 participants