From: markt Date: Tue, 11 Jan 2011 18:35:42 +0000 (+0000) Subject: Action review comments X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=c0fadb6bf700079980d01f339f8f0f229b7fca29;p=tomcat7.0 Action review comments Store deployIgnore as a Pattern in the Host git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1057788 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/Host.java b/java/org/apache/catalina/Host.java index 37b1f9846..e827f20d5 100644 --- a/java/org/apache/catalina/Host.java +++ b/java/org/apache/catalina/Host.java @@ -16,6 +16,8 @@ */ package org.apache.catalina; +import java.util.regex.Pattern; + /** * A Host is a Container that represents a virtual host in the @@ -154,6 +156,14 @@ public interface Host extends Container { /** + * Return the compiled regular expression that defines the files and + * directories in the host's {@link #appBase} that will be ignored by the + * automatic deployment process. + */ + public Pattern getDeployIgnorePattern(); + + + /** * Set the regular expression that defines the files and directories in * the host's {@link #appBase} that will be ignored by the automatic * deployment process. diff --git a/java/org/apache/catalina/core/StandardHost.java b/java/org/apache/catalina/core/StandardHost.java index d7a60552a..c78dbe9cb 100644 --- a/java/org/apache/catalina/core/StandardHost.java +++ b/java/org/apache/catalina/core/StandardHost.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.WeakHashMap; +import java.util.regex.Pattern; import org.apache.catalina.Container; import org.apache.catalina.Context; @@ -173,7 +174,7 @@ public class StandardHost extends ContainerBase implements Host { * be ignored by the automatic deployment process (both * {@link #deployOnStartup} and {@link #autoDeploy}). */ - private String deployIgnore = null; + private Pattern deployIgnore = null; // ------------------------------------------------------------- Properties @@ -515,6 +516,20 @@ public class StandardHost extends ContainerBase implements Host { */ @Override public String getDeployIgnore() { + if (deployIgnore == null) { + return null; + } + return this.deployIgnore.toString(); + } + + + /** + * Return the compiled regular expression that defines the files and + * directories in the host's {@link #appBase} that will be ignored by the + * automatic deployment process. + */ + @Override + public Pattern getDeployIgnorePattern() { return this.deployIgnore; } @@ -526,11 +541,20 @@ public class StandardHost extends ContainerBase implements Host { */ @Override public void setDeployIgnore(String deployIgnore) { - String oldDeployIgnore = this.deployIgnore; - this.deployIgnore = deployIgnore; + String oldDeployIgnore; + if (this.deployIgnore == null) { + oldDeployIgnore = null; + } else { + oldDeployIgnore = this.deployIgnore.toString(); + } + if (deployIgnore == null) { + this.deployIgnore = null; + } else { + this.deployIgnore = Pattern.compile(deployIgnore); + } support.firePropertyChange("deployIgnore", oldDeployIgnore, - this.deployIgnore); + deployIgnore); } diff --git a/java/org/apache/catalina/startup/HostConfig.java b/java/org/apache/catalina/startup/HostConfig.java index 696d47473..9d46ff5e6 100644 --- a/java/org/apache/catalina/startup/HostConfig.java +++ b/java/org/apache/catalina/startup/HostConfig.java @@ -486,12 +486,14 @@ public class HostConfig return unfilteredAppPaths; } - Pattern filter = Pattern.compile(host.getDeployIgnore()); + Pattern filter = host.getDeployIgnorePattern(); List filteredList = new ArrayList(); for (String appPath : unfilteredAppPaths) { if (filter.matcher(appPath).matches()) { - log.debug(sm.getString("hostConfig.ignorePath", appPath)); + if (log.isDebugEnabled()) { + log.debug(sm.getString("hostConfig.ignorePath", appPath)); + } } else { filteredList.add(appPath); }