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: [email protected]
For additional commands, e-mail: [email protected]