-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
includeAll() resolve FileSystemResource when run with spring-boot:run… #1645
includeAll() resolve FileSystemResource when run with spring-boot:run… #1645
Conversation
…. But SpringResourceAccessor.openStream() alway add 'classpath:' prefix to resource string event if it has 'file:' url string already. it produce string like 'classpth:file:xxxxx' that wrong path. So it fail when getInputStream() I fix by detect if it already has 'file:' no need to add extra 'classpath:'
Codecov Report
@@ Coverage Diff @@
## master #1645 +/- ##
=========================================
Coverage 48.20% 48.20%
- Complexity 7960 7961 +1
=========================================
Files 796 796
Lines 38705 38706 +1
Branches 6953 6953
=========================================
+ Hits 18658 18660 +2
+ Misses 17546 17545 -1
Partials 2501 2501
Continue to review full report at Codecov.
|
I create demo project at https://github.com/pramoth/liquibase-mvn-run-fail-demo |
Hi @pramoth Is this a possible fix for #1595 and #1657? A member of the Liquibase team will take a look at your contribution and may suggest:
The PR will be prioritized according to our internal development and testing capacity. We’ll let you know when it’s ready to move to the next step or if any changes are needed. |
➤ Nathan Voxland commented: I'll double check the code in this PR to make sure there isn't anything we still want to bring in vs #1665 |
➤ Mario Champion commented: hey Nathan Voxland -- after you check into this one make sure to let Erzsebet Carmean know so she can add test points. |
It looks like #1665 has the same fixes as this PR, so closing this one. |
…. But SpringResourceAccessor.openStream() alway add 'classpath:' prefix to resource string event if it has 'file:' url string already. it produce string like 'classpth:file:xxxxx' that wrong path. So it fail when getInputStream()
I fix by detect if it already has 'file:' no need to add extra 'classpath:'
Environment
Liquibase Version: 4.2.2
Liquibase Integration & Version: maven
Liquibase Extension(s) & Version: 4.2.2
Database Vendor & Version: All
Operating System Type & Version: Linux
Pull Request Type
Description
A clear and concise description of the issue being addressed. Additional guidance here.
when
mvn spring-boot:run
includeAll() will load all file withResourcePatternUtils.getResourcePatternResolver(resourceLoader).getResources(searchPath)
it return FileSystemResource ( file: prefix )when
SpringResourceAccessor.openStream()
is call for each file it add additionalclasspath:
prefix (in methodfinalizeSearchPath()
). it will look like 'classpath:file:xxxx" which is wrong path hence it produce FileNotFoundException ( exception was swallow).I fixed by detect if url with
file:
prefix then skip addclasspath:
to url.Steps To Reproduce
List the steps to reproduce the behavior.
Please be precise and ensure private information is redacted
Include things like
add
<includeAll path="some-directory" errorIfMissingOrEmpty="true">
to changelog file and runmvn-spring-boot:run
it will cause errorbut it run fine with same configuration with `java -jar Xxx.jar'
Actual Behavior
A clear and concise description of what happens in the software before this pull request.
Demo project https://github.com/pramoth/liquibase-mvn-run-fail-demo
When use
<includeAll path="some-directory" errorIfMissingOrEmpty="true">
with mvn spring-boot:run cause an error ( but it run fine with java -jar )error message :
Log also wrong because it run fine with
java -jar
hence message not relevantExpected/Desired Behavior
A clear and concise description of what happens in the software after this pull request.
mvn spring-boot:run ---> PASS
java -jat Xxx.jar --> PASS
Screenshots (if appropriate)
If applicable, add screenshots to help explain your problem.
Additional Context
Add any other context about the problem here.
Fast Track PR Acceptance Checklist:
Need Help?
Come chat with us on our discord channel