Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-4119

NPE in PojoBuilderHelper where static methods follow bean convention

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 4.3.0
    • Affects Version/s: None
    • Component/s: None
    • None

      Classes that have a static method that follows the bean convention cause a NPE.

      For example:

      public static void getStringField$Annotations() {
          // Mimics the static kotlin synthetic annotations field
      } 

       

      An example where this can automatically occur is when using annotations in Kotlin on non data classes.

       


      Was: NPE in PojoBuilderHelper class for object with custom annotation

      Hi I have a project (Kotlin + Spring Boot Data) which fails with null pointer exception when upsert is happening.
      I've prepared test project to reproduce the issue: https://github.com/Skiv1989/spring-data-mongo-test

      If you run the project it will try to store TestDto class, the class has an field with @SearchCriteria annotation. If I got correctly pojo converter thinks that annotation is a class field and trying to map it, which leads to NPE

      Can you check please or advise how to avoid such exception?

      As temporary solution I've made copy of dto classes, but without annotations and then maps dto to dom before store, but classes are absolutely same, so I want to avoid this duplication.

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            iskvort@gmail.com Sk Iv
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: