Uploaded image for project: 'Hibernate Search'
  1. HSEARCH-2909

NPE using a custom annotation on a non-indexed class

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.8.2.Final, 5.9.0.Beta1
    • Component/s: None
    • Labels:
      None

      Description

      I have a custom annotation in my main project using play framework v1.5, that's not coming from an external dependency (jar). Using this annotation on a non-indexed class results in a NPE while building the SessionFactory:

      java.lang.NullPointerException at org.hibernate.search.util.impl.ReflectionHelper.isSearchAnnotation(ReflectionHelper.java:181)

      Looking at the code in the debugger shows, that annotation.annotationType().getPackage() returns null for my custom annotation (at this time). A behavior that's documented in the getPackage() method, so it's valid, although I can't reproduce it with a stand-alone test-case w/out using the play-framework with all its classloading magic
      Nonetheless I think a null-check should be added in ReflectionHelper#isSearchAnnotation(...) to avoid this.

        Attachments

          Activity

            People

            • Assignee:
              sebastianbeigel Sebastian Beigel
              Reporter:
              sebastianbeigel Sebastian Beigel
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: