geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r783558 - /geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/DefaultInstanceManager.java
Date Wed, 10 Jun 2009 22:37:47 GMT
Author: djencks
Date: Wed Jun 10 22:37:46 2009
New Revision: 783558

URL: http://svn.apache.org/viewvc?rev=783558&view=rev
Log:
Apply bit of TOMCAT_6_0_18-G678601 patch that makes sense

Modified:
    geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/DefaultInstanceManager.java

Modified: geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/DefaultInstanceManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/DefaultInstanceManager.java?rev=783558&r1=783557&r2=783558&view=diff
==============================================================================
--- geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/DefaultInstanceManager.java
(original)
+++ geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/catalina/src/main/java/org/apache/catalina/core/DefaultInstanceManager.java
Wed Jun 10 22:37:46 2009
@@ -245,64 +245,70 @@
             return;
         }
 
-        // Initialize fields annotations
-        Field[] fields = instance.getClass().getDeclaredFields();
-        for (Field field : fields) {
-            if (injections != null && injections.containsKey(field.getName())) {
-                lookupFieldResource(context, instance, field, injections.get(field.getName()));
-            } else if (field.isAnnotationPresent(Resource.class)) {
-                Resource annotation = field.getAnnotation(Resource.class);
-                lookupFieldResource(context, instance, field, annotation.name());
-            } else if (field.isAnnotationPresent(EJB.class)) {
-                EJB annotation = field.getAnnotation(EJB.class);
-                lookupFieldResource(context, instance, field, annotation.name());
-            } else if (field.isAnnotationPresent(WebServiceRef.class)) {
-                WebServiceRef annotation =
+        Class<?> clazz = instance.getClass();
+
+        while (clazz != null) {
+            // Initialize fields annotations
+            Field[] fields = instance.getClass().getDeclaredFields();
+            for (Field field : fields) {
+                if (injections != null && injections.containsKey(field.getName()))
{
+                    lookupFieldResource(context, instance, field, injections.get(field.getName()));
+                }
+                if (field.isAnnotationPresent(Resource.class)) {
+                    Resource annotation = field.getAnnotation(Resource.class);
+                    lookupFieldResource(context, instance, field, annotation.name());
+                } else if (field.isAnnotationPresent(EJB.class)) {
+                    EJB annotation = field.getAnnotation(EJB.class);
+                    lookupFieldResource(context, instance, field, annotation.name());
+                } else if (field.isAnnotationPresent(WebServiceRef.class)) {
+                    WebServiceRef annotation =
                         field.getAnnotation(WebServiceRef.class);
-                lookupFieldResource(context, instance, field, annotation.name());
-            } else if (field.isAnnotationPresent(PersistenceContext.class)) {
-                PersistenceContext annotation =
+                    lookupFieldResource(context, instance, field, annotation.name());
+                } else if (field.isAnnotationPresent(PersistenceContext.class)) {
+                    PersistenceContext annotation =
                         field.getAnnotation(PersistenceContext.class);
-                lookupFieldResource(context, instance, field, annotation.name());
-            } else if (field.isAnnotationPresent(PersistenceUnit.class)) {
-                PersistenceUnit annotation =
+                    lookupFieldResource(context, instance, field, annotation.name());
+                } else if (field.isAnnotationPresent(PersistenceUnit.class)) {
+                    PersistenceUnit annotation =
                         field.getAnnotation(PersistenceUnit.class);
-                lookupFieldResource(context, instance, field, annotation.name());
+                    lookupFieldResource(context, instance, field, annotation.name());
+                }
             }
-        }
 
-        // Initialize methods annotations
-        Method[] methods = instance.getClass().getDeclaredMethods();
-        for (Method method : methods) {
-            String methodName = method.getName();
-            if (injections != null && methodName.startsWith("set") && methodName.length()
> 3) {
-                String fieldName = Character.toLowerCase(methodName.charAt(3)) + methodName.substring(4);
-                if (injections.containsKey(fieldName)) {
-                    lookupMethodResource(context, instance, method, injections.get(fieldName));
-                    break;
+            // Initialize methods annotations
+            Method[] methods = instance.getClass().getDeclaredMethods();
+            for (Method method : methods) {
+                String methodName = method.getName();
+                if (injections != null && methodName.startsWith("set") &&
methodName.length() > 3) {
+                    String fieldName = Character.toLowerCase(methodName.charAt(3)) + methodName.substring(4);
+                    if (injections.containsKey(fieldName)) {
+                        lookupMethodResource(context, instance, method, injections.get(fieldName));
+                        break;
+                    }
                 }
-            }
-            if (method.isAnnotationPresent(Resource.class)) {
-                Resource annotation = method.getAnnotation(Resource.class);
-                lookupMethodResource(context, instance, method, annotation.name());
-            } else if (method.isAnnotationPresent(EJB.class)) {
-                EJB annotation = method.getAnnotation(EJB.class);
-                lookupMethodResource(context, instance, method, annotation.name());
-            } else if (method.isAnnotationPresent(WebServiceRef.class)) {
-                WebServiceRef annotation =
+                if (method.isAnnotationPresent(Resource.class)) {
+                    Resource annotation = method.getAnnotation(Resource.class);
+                    lookupMethodResource(context, instance, method, annotation.name());
+                } else if (method.isAnnotationPresent(EJB.class)) {
+                    EJB annotation = method.getAnnotation(EJB.class);
+                    lookupMethodResource(context, instance, method, annotation.name());
+                } else if (method.isAnnotationPresent(WebServiceRef.class)) {
+                    WebServiceRef annotation =
                         method.getAnnotation(WebServiceRef.class);
-                lookupMethodResource(context, instance, method, annotation.name());
-            } else if (method.isAnnotationPresent(PersistenceContext.class)) {
-                PersistenceContext annotation =
+                    lookupMethodResource(context, instance, method, annotation.name());
+                } else if (method.isAnnotationPresent(PersistenceContext.class)) {
+                    PersistenceContext annotation =
                         method.getAnnotation(PersistenceContext.class);
-                lookupMethodResource(context, instance, method, annotation.name());
-            } else if (method.isAnnotationPresent(PersistenceUnit.class)) {
-                PersistenceUnit annotation =
+                    lookupMethodResource(context, instance, method, annotation.name());
+                } else if (method.isAnnotationPresent(PersistenceUnit.class)) {
+                    PersistenceUnit annotation =
                         method.getAnnotation(PersistenceUnit.class);
-                lookupMethodResource(context, instance, method, annotation.name());
+                    lookupMethodResource(context, instance, method, annotation.name());
+                }
             }
-        }
 
+            clazz = clazz.getSuperclass();
+        }
     }
 
 



Mime
View raw message