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

commit_date_instant NullPointerException when committing entities created prior 5.1.3 #782

kkonstantin42 opened this Issue Feb 14, 2019 · 3 comments


None yet
2 participants
Copy link

kkonstantin42 commented Feb 14, 2019

I have upgraded our project from Javers 3.12.1 to 5.1.3 and now getting NullPointerException (stacktrace below) when committing entities that have older commits that were done before the upgrade. Committing new entities works well. We are using SqlRepository with postgresql database.

Done a bit of digging into the source code and it looks like exception happens when Javers is deserialising commit_date_instant column value in SnapshotQuery:166 which is always null for older commits.

Here is a relevant part of the stack trace:

 java.lang.NullPointerException: text
        at java.util.Objects.requireNonNull(
        at java.time.format.DateTimeFormatter.parse(
        at java.time.Instant.parse(
        at org.javers.core.json.CdoSnapshotSerialized.withCommitDateInstant(
        at org.javers.repository.sql.finders.SnapshotQuery$CdoSnapshotMapper.get(
        at org.javers.repository.sql.finders.SnapshotQuery$CdoSnapshotMapper.get(
        at org.javers.repository.sql.session.PreparedStatementExecutor.lambda$executeQuery$5(
        at org.javers.repository.sql.session.PreparedStatementExecutor$$Lambda$1279/63189136.callAndGet(Unknown Source)
        at org.javers.repository.sql.session.PreparedStatementExecutor.wrapExceptionAndCall(
        at org.javers.repository.sql.session.PreparedStatementExecutor.runSql(
        at org.javers.repository.sql.session.PreparedStatementExecutor.executeQuery(
        at org.javers.repository.sql.session.Session.executeQuery(
        at org.javers.repository.sql.session.SelectBuilder.executeQuery(
        at org.javers.repository.sql.finders.CdoSnapshotFinder.fetchCdoSnapshots(
        at org.javers.repository.sql.finders.CdoSnapshotFinder.lambda$getLatest$1(
        at org.javers.repository.sql.finders.CdoSnapshotFinder$$Lambda$1270/1714142470.apply(Unknown Source)
        at org.javers.repository.sql.finders.CdoSnapshotFinder.getLatest(
        at org.javers.repository.sql.JaversSqlRepository.lambda$getLatest$0(
        at org.javers.repository.sql.JaversSqlRepository$$Lambda$1266/145383050.apply(Unknown Source)
        at java.util.HashMap$KeySpliterator.forEachRemaining(
        at org.javers.repository.sql.JaversSqlRepository.getLatest(
        at org.javers.repository.api.JaversExtendedRepository.getLatest(
        at org.javers.core.snapshot.SnapshotGraphFactory.createLatest(
        at org.javers.core.commit.CommitFactory.createCommit(
        at org.javers.core.commit.CommitFactory.create(
        at org.javers.core.JaversCore.commit(

This comment has been minimized.

Copy link

bartoszwalacik commented Feb 15, 2019

that's easy to fix, consider contributing a PR


This comment has been minimized.

Copy link

kkonstantin42 commented Feb 16, 2019

Sure, will do a PR


This comment has been minimized.

Copy link

bartoszwalacik commented Feb 16, 2019

fix released in 5.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.