Author: markt
Date: Fri Oct  8 21:46:05 2010
New Revision: 1006037

URL: http://svn.apache.org/viewvc?rev=1006037&view=rev
Log:
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.

Modified:
    tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1006037&r1=1006036&r2=1006037&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Fri Oct  8 
21:46:05 2010
@@ -1760,9 +1760,13 @@ public class StandardContext extends Con
         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());
+        }
     }
 
 

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1006037&r1=1006036&r2=1006037&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Fri Oct  8 21:46:05 2010
@@ -104,6 +104,10 @@
         sebb. (markt)
       </update>
       <fix>
+        <bug>50027</bug>: Avoid NPE on start when a Context is defined in
+        server.xml with one or more JNDI resources. (markt)
+      </fix>
+      <fix>
         <bug>50059</bug>: JARs should always be searched for static resources
         even if the web application is marked as meta-data complete. (markt)
       </fix>



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

Reply via email to