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

NullPointerException when Levenshtein distance and NewObjectsSnapshot are used together #820

bkuzio opened this Issue Apr 2, 2019 · 2 comments


None yet
2 participants
Copy link

bkuzio commented Apr 2, 2019


When configuring Javers to use new objects snapshot and Levenshtein distance list comparison, then comparing to null object, I'm getting NullPointerException. It doesn't happen when either a different list comparison method is used or new object snapshot is not used.

Test case to reproduce (version 5.3.4):

class BugTest {

    void shouldNotFail() {
        Javers javers = JaversBuilder.javers().withNewObjectsSnapshot(true)
                                     .withListCompareAlgorithm(ListCompareAlgorithm.LEVENSHTEIN_DISTANCE).build();, new Obj(Collections.singletonList("test")));
    static class Obj {
        private List<String> strings;

        public Obj(List<String> strings) {
            this.strings = strings;

The issue seems to be similar to #240, but not exactly the same.

Same error happens when comparing a list to an empty list:
javers.compareCollections(Collections.emptyList(), Collections.singletonList(obj));

Stack trace:

at org.javers.core.diff.appenders.levenshtein.Backtrack.evaluateSteps(
at org.javers.core.diff.appenders.levenshtein.LevenshteinListChangeAppender.calculateChanges(
at org.javers.core.diff.appenders.levenshtein.LevenshteinListChangeAppender.calculateChanges(
at org.javers.core.diff.appenders.CorePropertyChangeAppender.calculateChanges(
at org.javers.core.diff.DiffFactory.appendChanges(
at org.javers.core.diff.DiffFactory.appendPropertyChanges(
at org.javers.core.diff.DiffFactory.createAndAppendChanges(
at org.javers.core.diff.DiffFactory.create(

@bartoszwalacik bartoszwalacik added the bug label Apr 8, 2019

bartoszwalacik added a commit that referenced this issue Apr 9, 2019

bartoszwalacik added a commit that referenced this issue Apr 10, 2019


This comment has been minimized.

Copy link

bartoszwalacik commented Apr 10, 2019

fixed in 5.3.6


This comment has been minimized.

Copy link

bkuzio commented Apr 11, 2019

Thanks! Can confirm that it works.

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.