Return-Path: X-Original-To: apmail-shiro-dev-archive@www.apache.org Delivered-To: apmail-shiro-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C225C10B22 for ; Fri, 17 Jan 2014 09:39:25 +0000 (UTC) Received: (qmail 74715 invoked by uid 500); 17 Jan 2014 09:39:24 -0000 Delivered-To: apmail-shiro-dev-archive@shiro.apache.org Received: (qmail 74652 invoked by uid 500); 17 Jan 2014 09:39:21 -0000 Mailing-List: contact dev-help@shiro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@shiro.apache.org Delivered-To: mailing list dev@shiro.apache.org Received: (qmail 74622 invoked by uid 99); 17 Jan 2014 09:39:21 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Jan 2014 09:39:21 +0000 Date: Fri, 17 Jan 2014 09:39:21 +0000 (UTC) From: "Sergiy Sokolenko (JIRA)" To: dev@shiro.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (SHIRO-473) DefaultAnnotationResolver.getAnnotation throws NullPointerException MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/SHIRO-473?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sergiy Sokolenko updated SHIRO-473: ----------------------------------- Description: h3. Bug Description The method org.apache.shiro.aop.DefaultAnnotationResolver.getAnnotation throws NullPointerException when a given MethodInvocation argument represents static method: h3. Technical Info [http://shiro.apache.org/static/1.2.2/apidocs/src-html/org/apache/shiro/aop/DefaultAnnotationResolver.html#line.62]: {code} return annotation == null ? mi.getThis().getClass().getAnnotation(clazz) : annotation; {code} 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. h3. Resolution See attached patch: DefaultAnnotationResolver.java.patch. was: h3. Bug Description The method org.apache.shiro.aop.DefaultAnnotationResolver.getAnnotation throws NullPointerException when a given MethodInvocation argument represents static method: h3. Technical Info [http://shiro.apache.org/static/1.2.2/apidocs/src-html/org/apache/shiro/aop/DefaultAnnotationResolver.html#line.62]: {code} return annotation == null ? mi.getThis().getClass().getAnnotation(clazz) : annotation; {code} 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. h3. Resolution See attached patch [^DefaultAnnotationResolver.java.patch] > DefaultAnnotationResolver.getAnnotation throws NullPointerException > ------------------------------------------------------------------- > > Key: SHIRO-473 > URL: https://issues.apache.org/jira/browse/SHIRO-473 > Project: Shiro > Issue Type: Bug > Components: Integration: JEE > Affects Versions: 1.2.2 > Environment: Cross platform / Play Framework 2.2 > Reporter: Sergiy Sokolenko > Labels: AOP, AnnotationResolver, NullPointerException > Attachments: DefaultAnnotationResolver.java.patch > > > h3. Bug Description > The method org.apache.shiro.aop.DefaultAnnotationResolver.getAnnotation throws NullPointerException when a given MethodInvocation argument represents static method: > h3. Technical Info > [http://shiro.apache.org/static/1.2.2/apidocs/src-html/org/apache/shiro/aop/DefaultAnnotationResolver.html#line.62]: > {code} > return annotation == null ? mi.getThis().getClass().getAnnotation(clazz) : annotation; > {code} > 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. > h3. Resolution > See attached patch: DefaultAnnotationResolver.java.patch. -- This message was sent by Atlassian JIRA (v6.1.5#6160)