question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NPE triggered by liquibase.Scope.getLog

See original GitHub issue

Environment

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:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Treehoppercommented, Sep 24, 2020

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

0reactions
Treehoppercommented, Jun 30, 2021

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found