From c147038eb6c99a475e46754186623d86e1a7f540 Mon Sep 17 00:00:00 2001 From: markt Date: Thu, 8 Sep 2011 15:37:06 +0000 Subject: [PATCH] Fix possible NPE if instances aren't created through the DefaultInstanceManager but are destroyed through it. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1166752 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/core/DefaultInstanceManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/java/org/apache/catalina/core/DefaultInstanceManager.java b/java/org/apache/catalina/core/DefaultInstanceManager.java index d0fe3c57e..b354fc26b 100644 --- a/java/org/apache/catalina/core/DefaultInstanceManager.java +++ b/java/org/apache/catalina/core/DefaultInstanceManager.java @@ -205,6 +205,10 @@ public class DefaultInstanceManager implements InstanceManager { // At the end the postconstruct annotated // method is invoked List annotations = annotationCache.get(clazz); + if (annotations == null) { + // instance not created through the instance manager + return; + } for (AnnotationCacheEntry entry : annotations) { if (entry.getType() == AnnotationCacheEntryType.PRE_DESTROY) { Method preDestroy = (Method) entry.getAccessibleObject(); -- 2.11.0