You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2016/03/04 16:00:10 UTC

svn commit: r1733602 - in /tomcat/trunk: java/org/apache/catalina/startup/HostConfig.java webapps/docs/changelog.xml

Author: markt
Date: Fri Mar  4 15:00:09 2016
New Revision: 1733602

URL: http://svn.apache.org/viewvc?rev=1733602&view=rev
Log:
When a Host is configured with an appBase that does not exist, create the appBase before trying to expand an external WAR file into it.

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java?rev=1733602&r1=1733601&r2=1733602&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java Fri Mar  4 15:00:09 2016
@@ -278,6 +278,8 @@ public class HostConfig implements Lifec
         // Process the event that has occurred
         if (event.getType().equals(Lifecycle.PERIODIC_EVENT)) {
             check();
+        } else if (event.getType().equals(Lifecycle.BEFORE_START_EVENT)) {
+            beforeStart();
         } else if (event.getType().equals(Lifecycle.START_EVENT)) {
             start();
         } else if (event.getType().equals(Lifecycle.STOP_EVENT)) {
@@ -1508,6 +1510,18 @@ public class HostConfig implements Lifec
     }
 
 
+    public void beforeStart() {
+        if (host.getCreateDirs()) {
+            File[] dirs = new File[] {host.getAppBaseFile(),host.getConfigBaseFile()};
+            for (int i=0; i<dirs.length; i++) {
+                if (!dirs[i].mkdirs() && !dirs[i].isDirectory()) {
+                    log.error(sm.getString("hostConfig.createDirs",dirs[i]));
+                }
+            }
+        }
+    }
+
+
     /**
      * Process a "start" event for this Host.
      */
@@ -1526,15 +1540,6 @@ public class HostConfig implements Lifec
             log.error(sm.getString("hostConfig.jmx.register", oname), e);
         }
 
-        if (host.getCreateDirs()) {
-            File[] dirs = new File[] {host.getAppBaseFile(),host.getConfigBaseFile()};
-            for (int i=0; i<dirs.length; i++) {
-                if (!dirs[i].mkdirs() && !dirs[i].isDirectory()) {
-                    log.error(sm.getString("hostConfig.createDirs",dirs[i]));
-                }
-            }
-        }
-
         if (!host.getAppBaseFile().isDirectory()) {
             log.error(sm.getString("hostConfig.appBase", host.getName(),
                     host.getAppBaseFile().getPath()));

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1733602&r1=1733601&r2=1733602&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Fri Mar  4 15:00:09 2016
@@ -145,6 +145,11 @@
         on non-Windows systems implemented in <code>catalina.sh</code> so it
         works correctly with Cygwin. Patch provided by Ed Randall. (markt)
       </fix>
+      <fix>
+        When a Host is configured with an appBase that does not exist, create
+        the appBase before trying to expand an external WAR file into it.
+        (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



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