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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 16df2d802e Fix BZ 66527 - docBase must be absolute here
16df2d802e is described below

commit 16df2d802efef1de344a629c97eb1ebb489283c1
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Mar 14 18:21:39 2023 +0000

    Fix BZ 66527 - docBase must be absolute here
    
    https://bz.apache.org/bugzilla/show_bug.cgi?id=66527
---
 java/org/apache/catalina/startup/Tomcat.java | 8 ++++----
 webapps/docs/changelog.xml                   | 5 +++++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/catalina/startup/Tomcat.java 
b/java/org/apache/catalina/startup/Tomcat.java
index 275558c34d..779ab28873 100644
--- a/java/org/apache/catalina/startup/Tomcat.java
+++ b/java/org/apache/catalina/startup/Tomcat.java
@@ -241,7 +241,7 @@ public class Tomcat {
      *
      * @param contextPath The context mapping to use, "" for root context.
      * @param docBase     Base directory for the context, for static files. 
Must
-     *                        exist, relative to the server home
+     *                        exist and be an absolute path.
      *
      * @return the deployed context
      */
@@ -715,7 +715,7 @@ public class Tomcat {
      * @param host        The host in which the context will be deployed
      * @param contextPath The context mapping to use, "" for root context.
      * @param docBase     Base directory for the context, for static files. 
Must
-     *                        exist, relative to the server home
+     *                        exist and be an absolute path.
      *
      * @return the deployed context
      */
@@ -748,7 +748,7 @@ public class Tomcat {
      * @param host        The host in which the context will be deployed
      * @param contextPath The context mapping to use, "" for root context.
      * @param docBase     Base directory for the context, for static files. 
Must
-     *                        exist, relative to the server home
+     *                        exist and be an absolute path.
      * @param config      Custom context configuration helper. Any 
configuration
      *                        will be in addition to equivalent of the default
      *                        web.xml configuration described above.
@@ -1258,7 +1258,7 @@ public class Tomcat {
     }
 
     protected URL getWebappConfigFile(String path, String contextName) {
-        File docBase = new File(path);
+        File docBase = new File(server.getCatalinaBase(), path);
         if (docBase.isDirectory()) {
             return getWebappConfigFileFromDirectory(docBase, contextName);
         } else {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 01720dde4c..cc544b22b1 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -123,6 +123,11 @@
         <code>authenticationSessionTimeout</code> attribute of the FORM
         authenticator. (markt)
       </add>
+      <fix>
+        <bug>66527</bug>: Correct the Javadoc for the
+        <code>Tomcat.addWebapp()</code> methods that incorrectly stated that 
the
+        <code>docBase</code> parameter could be a relative path. (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