From d8e5ea68d9bb3eac8206b27c7c78835706643f1f Mon Sep 17 00:00:00 2001 From: Wesley Wannemacher Date: Thu, 18 Jun 2009 13:21:57 +0000 Subject: [PATCH] WW-3162, properly supporting inheritance for ParentPackage annotation git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@786050 13f79535-47bb-0310-9956-ffa450edef68 --- .../struts2/convention/annotation/AnnotationTools.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/annotation/AnnotationTools.java b/plugins/convention/src/main/java/org/apache/struts2/convention/annotation/AnnotationTools.java index d22bf9d08..d0902d67a 100644 --- a/plugins/convention/src/main/java/org/apache/struts2/convention/annotation/AnnotationTools.java +++ b/plugins/convention/src/main/java/org/apache/struts2/convention/annotation/AnnotationTools.java @@ -31,7 +31,7 @@ public class AnnotationTools { /** * Returns the annotation on the given class or the package of the class. This searchs up the - * class hierarchy and the package hierarchy. + * class hierarchy and the package hierarchy for the closest match. * * @param klass The class to search for the annotation. * @param annotationClass The Class of the annotation. @@ -45,9 +45,12 @@ public class AnnotationTools { ann = klass.getPackage().getAnnotation(annotationClass); if (ann == null) { klass = klass.getSuperclass(); + if (klass != null ) { + ann = klass.getAnnotation(annotationClass); + } } } return ann; } -} \ No newline at end of file +}