Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49551
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 5 Jul 2010 21:07:32 +0000 (21:07 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 5 Jul 2010 21:07:32 +0000 (21:07 +0000)
Allow default context.xml file to be specified using an absolute path.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@960701 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/startup/ContextConfig.java
webapps/docs/changelog.xml

index 7189d66..2dc6270 100644 (file)
@@ -537,7 +537,7 @@ public class ContextConfig
      */
     protected void contextConfig() {
         
-        // Open the default web.xml file, if it exists
+        // Open the default context.xml file, if it exists
         if( defaultContextXml==null && context instanceof StandardContext ) {
             defaultContextXml = ((StandardContext)context).getDefaultContextXml();
         }
@@ -545,7 +545,10 @@ public class ContextConfig
         if( defaultContextXml==null ) getDefaultContextXml();
 
         if (!context.getOverride()) {
-            File defaultContextFile = new File(getBaseDir(), defaultContextXml);
+            File defaultContextFile = new File(defaultContextXml);
+            if (!defaultContextFile.isAbsolute()) {
+                defaultContextFile =new File(getBaseDir(), defaultContextXml);
+            }
             if (defaultContextFile.exists()) {
                 try {
                     URL defaultContextUrl = defaultContextFile.toURI().toURL();
index 97cc5cf..aba3c9a 100644 (file)
         required to be used. No functional change. Patch provided by Sebb.
         (markt)
       </fix>
+      <fix>
+        <bug>49551</bug>: Allow default context.xml location to be specified
+        using an absolute path. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">