This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new 99693d4  Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63740 
xmlBase != null
99693d4 is described below

commit 99693d43c031c9ccbe2b7a691fb7078492936def
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Sep 10 18:32:49 2019 +0100

    Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63740 xmlBase != null
    
    Correctly locate configuration files when a Host has an xmlBase
    specified.
    
    Patch provided by uk4sx.
---
 java/org/apache/catalina/Container.java                   | 1 +
 java/org/apache/catalina/startup/ContextConfig.java       | 4 ++--
 java/org/apache/catalina/valves/rewrite/RewriteValve.java | 2 +-
 webapps/docs/changelog.xml                                | 5 +++++
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/Container.java 
b/java/org/apache/catalina/Container.java
index 177b2d2..f9da61e 100644
--- a/java/org/apache/catalina/Container.java
+++ b/java/org/apache/catalina/Container.java
@@ -319,6 +319,7 @@ public interface Container extends Lifecycle {
         if (host != null && ((Host) host).getXmlBase() != null) {
             result.append(((Host) host).getXmlBase()).append('/');
         } else {
+            result.append("conf/");
             if (engine != null) {
                 result.append(engine.getName()).append('/');
             }
diff --git a/java/org/apache/catalina/startup/ContextConfig.java 
b/java/org/apache/catalina/startup/ContextConfig.java
index b416f31..6b6928a 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -472,7 +472,7 @@ public class ContextConfig implements LifecycleListener {
 
             String hostContextFile = Container.getConfigPath(context, 
Constants.HostContextXml);
             try (ConfigurationSource.Resource contextXmlResource =
-                    
ConfigFileLoader.getSource().getConfResource(hostContextFile)) {
+                    ConfigFileLoader.getSource().getResource(hostContextFile)) 
{
                 URL defaultContextUrl = contextXmlResource.getURI().toURL();
                 processContextConfig(digester, defaultContextUrl, 
contextXmlResource.getInputStream());
             } catch (MalformedURLException e) {
@@ -1898,7 +1898,7 @@ public class ContextConfig implements LifecycleListener {
                 }
             } else {
                 String hostWebXml = Container.getConfigPath(context, 
Constants.HostWebXml);
-                webXmlResource = 
ConfigFileLoader.getSource().getConfResource(hostWebXml);
+                webXmlResource = 
ConfigFileLoader.getSource().getResource(hostWebXml);
             }
         } catch (IOException e) {
             // Ignore if not found
diff --git a/java/org/apache/catalina/valves/rewrite/RewriteValve.java 
b/java/org/apache/catalina/valves/rewrite/RewriteValve.java
index ca64326..68f0bc5 100644
--- a/java/org/apache/catalina/valves/rewrite/RewriteValve.java
+++ b/java/org/apache/catalina/valves/rewrite/RewriteValve.java
@@ -154,7 +154,7 @@ public class RewriteValve extends ValveBase {
         } else {
             String resourceName = Container.getConfigPath(getContainer(), 
resourcePath);
             try {
-                ConfigurationSource.Resource resource = 
ConfigFileLoader.getSource().getConfResource(resourceName);
+                ConfigurationSource.Resource resource = 
ConfigFileLoader.getSource().getResource(resourceName);
                 is = resource.getInputStream();
             } catch (IOException e) {
                 if (containerLog.isDebugEnabled()) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index a957436..61d7e56 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -56,6 +56,11 @@
         <code>RealmBase.hasRole()</code> for given security constraints.
         (michaelo)
       </fix>
+      <fix>
+        <bug>63740</bug>: Ensure configuration files are loaded correctly when 
a
+        <code>Host</code> is configured with an <code>xmlBase</code>. Patch
+        provided by uk4sx. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">


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

Reply via email to