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

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


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

commit afb2a24a13c4a02838a34ce341b7e19efaac6b77
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 a41f96433a..667276a8e9 100644
--- a/java/org/apache/catalina/startup/Tomcat.java
+++ b/java/org/apache/catalina/startup/Tomcat.java
@@ -239,7 +239,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
      */
@@ -711,7 +711,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
      */
@@ -744,7 +744,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.
@@ -1234,7 +1234,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 e1a30da06a..3df44e6ca5 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -147,6 +147,11 @@
         Reduce the default value of <code>maxParameterCount</code> from 10,000
         to 1,000. (markt)
       </update>
+      <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