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 2013/05/17 13:32:29 UTC

svn commit: r1483743 - in /tomcat/trunk/java/org/apache/catalina/startup: HostConfig.java LocalStrings.properties

Author: markt
Date: Fri May 17 11:32:28 2013
New Revision: 1483743

URL: http://svn.apache.org/r1483743
Log:
Add warning about 'hidden' DIRs in the appBase

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
    tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties

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=1483743&r1=1483742&r2=1483743&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java Fri May 17 11:32:28 2013
@@ -677,13 +677,34 @@ public class HostConfig
             if (files[i].equalsIgnoreCase("WEB-INF"))
                 continue;
             File war = new File(appBase, files[i]);
-            if (files[i].toLowerCase(Locale.ENGLISH).endsWith(".war") && war.isFile()
-                    && !invalidWars.contains(files[i]) ) {
+            if (files[i].toLowerCase(Locale.ENGLISH).endsWith(".war") &&
+                    war.isFile() && !invalidWars.contains(files[i]) ) {
 
                 ContextName cn = new ContextName(files[i]);
 
-                if (isServiced(cn.getName()) || deploymentExists(cn.getName()))
+                if (isServiced(cn.getName())) {
                     continue;
+                }
+                if (deploymentExists(cn.getName())) {
+                    DeployedApplication app = deployed.get(cn.getName());
+                    if (!unpackWARs && app != null) {
+                        // Need to check for a directory that should not be
+                        // there
+                        File dir = new File(appBase, cn.getBaseName());
+                        if (dir.exists()) {
+                            if (!app.loggedDirWarning) {
+                                log.warn(sm.getString(
+                                        "hostConfig.deployWar.hiddenDir",
+                                        dir.getAbsoluteFile(),
+                                        war.getAbsoluteFile()));
+                                app.loggedDirWarning = true;
+                            }
+                        } else {
+                            app.loggedDirWarning = false;
+                        }
+                    }
+                    continue;
+                }
 
                 // Check for WARs with /../ /./ or similar sequences in the name
                 if (!validateContextPath(appBase, cn.getBaseName())) {
@@ -1612,6 +1633,14 @@ public class HostConfig
          * Instant where the application was last put in service.
          */
         public long timestamp = System.currentTimeMillis();
+
+        /**
+         * In some circumstances, such as when unpackWARs is true, a directory
+         * may be added to the appBase that is ignored. This flag indicates that
+         * the user has been warned so that the warning is not logged on every
+         * run of the auto deployer.
+         */
+        public boolean loggedDirWarning = false;
     }
 
     private static class DeployDescriptor implements Runnable {

Modified: tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties?rev=1483743&r1=1483742&r2=1483743&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties Fri May 17 11:32:28 2013
@@ -92,6 +92,7 @@ hostConfig.deployDir.error=Error deployi
 hostConfig.deployDir.threaded.error=Error waiting for multi-thread deployment of directories to completehostConfig.deployWar=Deploying web application archive {0}
 hostConfig.deployWar=Deploying web application archive {0}
 hostConfig.deployWar.error=Error deploying web application archive {0}
+hostConfig.deployWar.hiddenDir=The directory [{0}] will be ignored because the WAR [{1}] takes priority and unpackWARs is false
 hostConfig.deployWar.threaded.error=Error waiting for multi-thread deployment of WAR files to complete
 hostConfig.deploy.error=Exception while deploying web application directory {0}
 hostConfig.deploying=Deploying discovered web applications



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