tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r550050 - in /tomcat/container/tc5.5.x: catalina/src/share/org/apache/catalina/deploy/NamingResources.java webapps/docs/changelog.xml
Date Sat, 23 Jun 2007 15:01:36 GMT
Author: markt
Date: Sat Jun 23 08:01:35 2007
New Revision: 550050

URL: http://svn.apache.org/viewvc?view=rev&rev=550050
Log:
Fix bug 42547. Fix NPE when a ResourceLink tries to override an env-entry.

Modified:
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/deploy/NamingResources.java
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml

Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/deploy/NamingResources.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/deploy/NamingResources.java?view=diff&rev=550050&r1=550049&r2=550050
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/deploy/NamingResources.java
(original)
+++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/deploy/NamingResources.java
Sat Jun 23 08:01:35 2007
@@ -25,6 +25,8 @@
 import java.util.Hashtable;
 import java.io.Serializable;
 
+import org.apache.catalina.ServerFactory;
+
 
 /**
  * Holds and manages the naming resources defined in the J2EE Enterprise 
@@ -185,9 +187,27 @@
     public void addEnvironment(ContextEnvironment environment) {
 
         if (entries.containsKey(environment.getName())) {
-            if (findEnvironment(environment.getName()).getOverride()) {
-                removeEnvironment(environment.getName());
+            ContextEnvironment ce = findEnvironment(environment.getName());
+            ContextResourceLink rl = findResourceLink(environment.getName());
+            if (ce != null) {
+                if (ce.getOverride()) {
+                    removeEnvironment(environment.getName());
+                } else {
+                    return;
+                }
+            } else if (rl != null) {
+                // Link. Need to look at the global resources
+                NamingResources global =
+                    ServerFactory.getServer().getGlobalNamingResources();
+                if (global.findEnvironment(rl.getGlobal()) != null) {
+                    if (global.findEnvironment(rl.getGlobal()).getOverride()) {
+                        removeResourceLink(environment.getName());
+                    } else {
+                        return;
+                    }
+                }
             } else {
+                // It exists but it isn't an env or a res link...
                 return;
             }
         }

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?view=diff&rev=550050&r1=550049&r2=550050
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Sat Jun 23 08:01:35 2007
@@ -27,6 +27,10 @@
         standard JMX system properties (-Dcom.sun.management.jmxremote.XXX). Currently only
included at src release (used JDK 1.5 classes)
         Feature provided by George Lindholm and Juergen Herrman (pero)
       </add>
+      <fix>
+        <bug>42547</bug>: Fix NPE when a ResourceLink in context.xml tries to
+        override an env-entry in web.xml.
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">



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


Mime
View raw message