NPE triggered by liquibase.Scope.getLog
See original GitHub issueEnvironment
Liquibase Version: 4.0.0
Description
I am getting an NPE when I create a new FileSystemResourceAccessor(rootPath), with the following stack trace:
java.lang.NullPointerException
at liquibase.Scope.getLog(Scope.java:278)
at liquibase.resource.FileSystemResourceAccessor.addRootPath(FileSystemResourceAccessor.java:54)
at liquibase.resource.FileSystemResourceAccessor.<init>(FileSystemResourceAccessor.java:36)
Looking at the Liquibase code, I see that SmartMap#get defines its result as a nullable, however, the Scope class does not check for null in this and other places.
Steps To Reproduce
I’m running tests in my project, using liquibase-core: Created this issue for tracking purposes, where you can also find the full stack trace: https://github.com/Treehopper/liquibase-lsp/issues/17
Additional Context
In my project, I have to run scripts asynchronously. This, and the fact that the problem only occurs occasionally hints at a race-condition.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Null pointer exception in Liquibase core - General Discussion
I was trying to create table by table in oracle DB by comparing changelogs. Caused by: java.lang.NullPointerException at liquibase.changelog.
Read more >Unexpected error running Liquibase: Unknown reason ...
I did find an old view and trigger that were created during research for the project for a different schema, which were never...
Read more >Liquibase 4.0 Extension Upgrade Guide
Learn about the impact of changes in the Liquibase 4.0 release that affect Liquibase extension developers, contributors, ... getLog(getClass()), Scope.
Read more >2016-February.txt - Jboss List Archives
Thread.run(Thread.java:745) > > Caused by: org.jboss.resteasy.spi. ... tables/columns in my schema using liquibase on start up of the keycloak server.
Read more >Deprecated List (liquibase-root 4.2.0 API) - javadoc.io
Use Scope.getLog(Class) · liquibase.change.core.AddForeignKeyConstraintChange.getReferencesUniqueColumn(). No longer supported in 3.0. liquibase.change.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Seems like one of the issues I have encountered has been fixed in the scope of this ticket: https://github.com/liquibase/liquibase/issues/1402
@nvoxland I agree that #1377 was a general defensive-programming-improvement. Thanks for updating. With respect to this issue, however, it was more than that, as it should prove the theory I have explained in the initial description, but wasn’t 100% confident about. As I don’t know the code very well, and the error I saw was only a follow-up problem of this assumed race-condition, I wanted to provide this proof as a justification for another change. If the exception would be thrown in the described scenarion, after merging the change, the next step might be for example synchronizing access on the scopeManager. As I mentioned in this comment, similar changes would be required elsewhere. To anybody using Liquibase in a multi-threaded environment, I’d recommend to synchronize access in the code calling the API, until these are fixed.
I’m not actively working on the project anymore which would use Liquibase in this way, so I cannot give more practical feedback, and probably won’t be able to provide that follow-up fix anytime soon, though.