Uploaded image for project: 'Shiro'
  1. Shiro
  2. SHIRO-473

DefaultAnnotationResolver.getAnnotation throws NullPointerException

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      Bug Description

      The method org.apache.shiro.aop.DefaultAnnotationResolver.getAnnotation throws NullPointerException when a given MethodInvocation argument represents static method:

      Technical Info

      http://shiro.apache.org/static/1.2.2/apidocs/src-html/org/apache/shiro/aop/DefaultAnnotationResolver.html#line.62:

      return annotation == null ? mi.getThis().getClass().getAnnotation(clazz) : annotation;
      

      if annotation is null and mi represents static method invocation, then mi.getThis() will return null causing the following chained call getClass() fail with NullPointerException.

      Resolution

      See attached patch: DefaultAnnotationResolver.java.diff.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            s.sokolenko Sergiy Sokolenko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment