- Fix some bugs with annotation support.
authorremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 26 May 2006 16:38:24 +0000 (16:38 +0000)
committerremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 26 May 2006 16:38:24 +0000 (16:38 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@409695 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/startup/WebAnnotationSet.java
java/org/apache/catalina/util/AnnotationProcessor.java

index 882b606..eef024a 100644 (file)
@@ -99,6 +99,10 @@ public class WebAnnotationSet {
             if (children[i] instanceof StandardWrapper) {\r
                 \r
                 wrapper = (StandardWrapper) children[i];\r
+                if (wrapper.getServletClass() == null) {\r
+                    continue;\r
+                }\r
+                \r
                 try {\r
                     classClass = classLoader.loadClass(wrapper.getServletClass());\r
                 } catch (ClassNotFoundException e) {\r
index 6b5b5f8..9288eb6 100644 (file)
@@ -30,8 +30,6 @@ import javax.persistence.PersistenceContext;
 import javax.persistence.PersistenceUnit;\r
 import javax.xml.ws.WebServiceRef;\r
 \r
-import org.apache.tomcat.util.IntrospectionUtils;\r
-\r
 \r
 /**\r
  * Verify the annotation and Process it.\r
@@ -49,7 +47,7 @@ public class AnnotationProcessor {
     public static void postConstruct(Object instance)\r
         throws IllegalAccessException, InvocationTargetException {\r
         \r
-        Method[] methods = IntrospectionUtils.findMethods(instance.getClass());\r
+        Method[] methods = instance.getClass().getDeclaredMethods();\r
         Method postConstruct = null;\r
         for (int i = 0; i < methods.length; i++) {\r
             if (methods[i].isAnnotationPresent(PostConstruct.class)) {\r
@@ -82,7 +80,7 @@ public class AnnotationProcessor {
     public static void preDestroy(Object instance)\r
         throws IllegalAccessException, InvocationTargetException {\r
         \r
-        Method[] methods = IntrospectionUtils.findMethods(instance.getClass());\r
+        Method[] methods = instance.getClass().getDeclaredMethods();\r
         Method preDestroy = null;\r
         for (int i = 0; i < methods.length; i++) {\r
             if (methods[i].isAnnotationPresent(PreDestroy.class)) {\r
@@ -116,7 +114,7 @@ public class AnnotationProcessor {
         throws IllegalAccessException, InvocationTargetException, NamingException {\r
         \r
         // Initialize fields annotations\r
-        Field[] fields = instance.getClass().getFields();\r
+        Field[] fields = instance.getClass().getDeclaredFields();\r
         for (int i = 0; i < fields.length; i++) {\r
             if (fields[i].isAnnotationPresent(Resource.class)) {\r
                 Resource annotation = (Resource) fields[i].getAnnotation(Resource.class);\r
@@ -144,7 +142,7 @@ public class AnnotationProcessor {
         }\r
         \r
         // Initialize methods annotations\r
-        Method[] methods = IntrospectionUtils.findMethods(instance.getClass());\r
+        Method[] methods = instance.getClass().getDeclaredMethods();\r
         for (int i = 0; i < methods.length; i++) {\r
             if (methods[i].isAnnotationPresent(Resource.class)) {\r
                 Resource annotation = (Resource) methods[i].getAnnotation(Resource.class);\r