Skip to content

Npe while gettings shadows #560

Description

@fsoylemez

Hello,
I am getting NullPointerException while trying to get shadows of an entity.
I build the query with instanceId and with parameter shadowscopedeep.And i have 'to' parameter set,as i want the latest shadow (if exist) till the provided time.(My javers version is 3.3.2)

This is how i call it;
` DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");

    E model = findById(id);
    QueryBuilder queryBuilder = QueryBuilder.byInstanceId(id, model.dtoClass()).withShadowScopeDeep();
    if(from!=null && !from.isEmpty()){
        queryBuilder.from(LocalDateTime.parse(from,formatter));
    }
    if(to!=null && !to.isEmpty()){
        queryBuilder.to(LocalDateTime.parse(to,formatter));
    }
    List<Shadow<E>> shadows = javers.findShadows(queryBuilder.build());`

And here is the stacktrace:
Caused by: java.lang.NullPointerException at org.javers.repository.jql.ShadowQueryRunner$CommitTable.lambda$loadFullCommits$78(ShadowQueryRunner.java:94) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) at org.javers.repository.jql.ShadowQueryRunner$CommitTable.loadFullCommits(ShadowQueryRunner.java:94) at org.javers.repository.jql.ShadowQueryRunner.queryForShadows(ShadowQueryRunner.java:36) at org.javers.repository.jql.QueryRunner.queryForShadows(QueryRunner.java:40) at org.javers.core.JaversCore.findShadows(JaversCore.java:143) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions