From: markt Date: Fri, 8 Oct 2010 21:46:05 +0000 (+0000) Subject: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50027 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=95b58cf2090c474f4633db33a2b946a01458658a;p=tomcat7.0 Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50027 Avoid NPE on start when a Context is defined in server.xml with one or more JNDI resources. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1006037 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index 1539318b3..e810ebf38 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -1760,9 +1760,13 @@ public class StandardContext extends ContainerBase support.firePropertyChange("namingResources", oldNamingResources, this.namingResources); - unregister(onameNamingResources); - onameNamingResources = register(namingResources, - "type=NamingResources," + getObjectKeyPropertiesNameOnly()); + // If set from server.xml, getObjectKeyPropertiesNameOnly() will + // trigger an NPE. Initial registration takes place on INIT. + if (getState() != LifecycleState.NEW) { + unregister(onameNamingResources); + onameNamingResources = register(namingResources, + "type=NamingResources," + getObjectKeyPropertiesNameOnly()); + } } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 4ea9ca2b5..9175867b5 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -104,6 +104,10 @@ sebb. (markt) + 50027: Avoid NPE on start when a Context is defined in + server.xml with one or more JNDI resources. (markt) + + 50059: JARs should always be searched for static resources even if the web application is marked as meta-data complete. (markt)