tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1172546 - /tomcat/trunk/java/org/apache/catalina/core/DefaultInstanceManager.java
Date Mon, 19 Sep 2011 10:00:04 GMT
Author: markt
Date: Mon Sep 19 10:00:04 2011
New Revision: 1172546

URL: http://svn.apache.org/viewvc?rev=1172546&view=rev
Log:
Prevent NPE if JNDI is disabled.

Modified:
    tomcat/trunk/java/org/apache/catalina/core/DefaultInstanceManager.java

Modified: tomcat/trunk/java/org/apache/catalina/core/DefaultInstanceManager.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/DefaultInstanceManager.java?rev=1172546&r1=1172545&r2=1172546&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/DefaultInstanceManager.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/DefaultInstanceManager.java Mon Sep 19 10:00:04
2011
@@ -179,13 +179,15 @@ public class DefaultInstanceManager impl
         // At the end the postconstruct annotated
         // method is invoked
         List<AnnotationCacheEntry> annotations = annotationCache.get(clazz);
-        for (AnnotationCacheEntry entry : annotations) {
-            if (entry.getType() == AnnotationCacheEntryType.POST_CONSTRUCT) {
-                Method postConstruct = (Method) entry.getAccessibleObject();
-                boolean accessibility = postConstruct.isAccessible();
-                postConstruct.setAccessible(true);
-                postConstruct.invoke(instance);
-                postConstruct.setAccessible(accessibility);
+        if (annotations != null) {
+            for (AnnotationCacheEntry entry : annotations) {
+                if (entry.getType() == AnnotationCacheEntryType.POST_CONSTRUCT) {
+                    Method postConstruct = (Method) entry.getAccessibleObject();
+                    boolean accessibility = postConstruct.isAccessible();
+                    postConstruct.setAccessible(true);
+                    postConstruct.invoke(instance);
+                    postConstruct.setAccessible(accessibility);
+                }
             }
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message