Author: markt
Date: Mon Aug 15 18:50:25 2011
New Revision: 1157943

URL: http://svn.apache.org/viewvc?rev=1157943&view=rev
Log:
Clean-up I do not intend to back-port (non-critical and changes the Host API)

Modified:
    tomcat/trunk/java/org/apache/catalina/Host.java
    tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
    tomcat/trunk/java/org/apache/catalina/core/StandardHost.java
    tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
    tomcat/trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java
    tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java
    tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
    tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java
    tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
    tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/Host.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Host.java?rev=1157943&r1=1157942&r2=1157943&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/Host.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Host.java Mon Aug 15 18:50:25 2011
@@ -16,6 +16,7 @@
  */
 package org.apache.catalina;
 
+import java.io.File;
 import java.util.regex.Pattern;
 
 
@@ -83,7 +84,7 @@ public interface Host extends Container 
      */
     public void setXmlBase(String xmlBase);
 
-        /**
+    /**
      * Return the application root for this Host.  This can be an absolute
      * pathname, a relative pathname, or a URL.
      */
@@ -91,6 +92,14 @@ public interface Host extends Container 
 
 
     /**
+     * Return an absolute {@link File} for the appBase of this Host. The file
+     * will be canonical if possible. There is no guarantee that that the
+     * appBase exists.
+     */
+    public File getAppBaseFile();
+
+
+    /**
      * Set the application root for this Host.  This can be an absolute
      * pathname, a relative pathname, or a URL.
      *

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1157943&r1=1157942&r2=1157943&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Mon Aug 15 
18:50:25 2011
@@ -5857,10 +5857,7 @@ public class StandardContext extends Con
                 docBase = (new File(engineBase(), getDocBase())).getPath();
             } else {
                 // Use the "appBase" property of this container
-                String appBase = ((Host) container).getAppBase();
-                file = new File(appBase);
-                if (!file.isAbsolute())
-                    file = new File(engineBase(), appBase);
+                file = ((Host) container).getAppBaseFile();
                 docBase = (new File(file, getDocBase())).getPath();
             }
         } else {

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardHost.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardHost.java?rev=1157943&r1=1157942&r2=1157943&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardHost.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardHost.java Mon Aug 15 
18:50:25 2011
@@ -17,6 +17,8 @@
 package org.apache.catalina.core;
 
 
+import java.io.File;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
@@ -26,6 +28,7 @@ import java.util.regex.Pattern;
 
 import org.apache.catalina.Container;
 import org.apache.catalina.Context;
+import org.apache.catalina.Globals;
 import org.apache.catalina.Host;
 import org.apache.catalina.Lifecycle;
 import org.apache.catalina.LifecycleEvent;
@@ -82,6 +85,7 @@ public class StandardHost extends Contai
      * The application root for this Host.
      */
     private String appBase = "webapps";
+    private volatile File appBaseFile = null;
 
     /**
      * The XML root for this Host.
@@ -186,23 +190,41 @@ public class StandardHost extends Contai
      */
     @Override
     public String getAppBase() {
-
         return (this.appBase);
-
     }
 
+
     /**
-     * Return the XML root for this Host.  This can be an absolute
-     * pathname, a relative pathname, or a URL.
-     * If null, defaults to ${catalina.base}/conf/ directory
+     * ({@inheritDoc}
      */
     @Override
-    public String getXmlBase() {
+    public File getAppBaseFile() {
+        
+        if (appBaseFile != null) {
+            return appBaseFile;
+        }
 
-        return (this.xmlBase);
+        File file = new File(getAppBase());
+        
+        // If not absolute, make it absolute
+        if (!file.isAbsolute()) {
+            // This system property should always be set
+            file = new File(System.getProperty(Globals.CATALINA_BASE_PROP),
+                    file.getPath());
+        }
+        
+        // Make it canonical if possible
+        try {
+            file = file.getCanonicalFile();
+        } catch (IOException ioe) {
+            // Ignore
+        }
 
+        this.appBaseFile = file;
+        return file;
     }
 
+
     /**
      * Set the application root for this Host.  This can be an absolute
      * pathname, a relative pathname, or a URL.
@@ -215,9 +237,23 @@ public class StandardHost extends Contai
         String oldAppBase = this.appBase;
         this.appBase = appBase;
         support.firePropertyChange("appBase", oldAppBase, this.appBase);
+        this.appBaseFile = null;
+    }
+
+
+    /**
+     * Return the XML root for this Host.  This can be an absolute
+     * pathname, a relative pathname, or a URL.
+     * If null, defaults to ${catalina.base}/conf/ directory
+     */
+    @Override
+    public String getXmlBase() {
+
+        return (this.xmlBase);
 
     }
-    
+
+
     /**
      * Set the Xml root for this Host.  This can be an absolute
      * pathname, a relative pathname, or a URL.
@@ -234,6 +270,7 @@ public class StandardHost extends Contai
 
     }
 
+
     /**
      * Returns true if the Host will attempt to create directories for appBase 
and xmlBase
      * unless they already exist.

Modified: tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java?rev=1157943&r1=1157942&r2=1157943&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java Mon 
Aug 15 18:50:25 2011
@@ -495,29 +495,6 @@ public class FarmWarDeployer extends Clu
     }
 
     /**
-     * Return a File object representing the "application root" directory for
-     * our associated Host.
-     */
-    protected File getAppBase() {
-
-        if (appBase != null) {
-            return appBase;
-        }
-
-        File file = new File(host.getAppBase());
-        if (!file.isAbsolute())
-            file = new File(System.getProperty(Globals.CATALINA_BASE_PROP), 
host
-                    .getAppBase());
-        try {
-            appBase = file.getCanonicalFile();
-        } catch (IOException e) {
-            appBase = file;
-        }
-        return (appBase);
-
-    }
-
-    /**
      * Invoke the remove method on the deployer.
      */
     protected void remove(String contextName) throws Exception {
@@ -530,8 +507,8 @@ public class FarmWarDeployer extends Clu
                         contextName));
             context.stop();
             String baseName = context.getBaseName();
-            File war = new File(getAppBase(), baseName + ".war");
-            File dir = new File(getAppBase(), baseName);
+            File war = new File(host.getAppBaseFile(), baseName + ".war");
+            File dir = new File(host.getAppBaseFile(), baseName);
             File xml = new File(configBase, baseName + ".xml");
             if (war.exists()) {
                 if (!war.delete()) {

Modified: tomcat/trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java?rev=1157943&r1=1157942&r2=1157943&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/manager/HTMLManagerServlet.java Mon 
Aug 15 18:50:25 2011
@@ -308,7 +308,7 @@ public final class HTMLManagerServlet ex
 
                 // Identify the appBase of the owning Host of this Context
                 // (if any)
-                File file = new File(getAppBase(), filename);
+                File file = new File(host.getAppBaseFile(), filename);
                 if (file.exists()) {
                     message = smClient.getString(
                             "htmlManagerServlet.deployUploadWarExists",

Modified: tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java?rev=1157943&r1=1157942&r2=1157943&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java Mon Aug 
15 18:50:25 2011
@@ -473,12 +473,7 @@ public class ManagerServlet extends Http
 
         // Identify the appBase of the owning Host of this Context
         // (if any)
-        String appBase = ((Host) context.getParent()).getAppBase();
-        deployed = new File(appBase);
-        if (!deployed.isAbsolute()) {
-            deployed = new File(System.getProperty(Globals.CATALINA_BASE_PROP),
-                                appBase);
-        }
+        deployed = ((Host) context.getParent()).getAppBaseFile();
         configBase = new File(System.getProperty(Globals.CATALINA_BASE_PROP), 
"conf");
         Container container = context;
         Container host = null;
@@ -667,7 +662,7 @@ public class ManagerServlet extends Http
                         File localWarCopy = new File(deployedPath, baseName + 
".war");
                         copy(localWar, localWarCopy);
                         localWar = localWarCopy;
-                        copy(localWar, new File(getAppBase(), baseName + 
".war"));
+                        copy(localWar, new File(host.getAppBaseFile(), 
baseName + ".war"));
                     }
                     // Perform new deployment
                     check(name);
@@ -735,7 +730,7 @@ public class ManagerServlet extends Http
             if (!isServiced(name)) {
                 addServiced(name);
                 try {
-                    copy(localWar, new File(getAppBase(), baseName + ".war"));
+                    copy(localWar, new File(host.getAppBaseFile(), baseName + 
".war"));
                     // Perform new deployment
                     check(name);
                 } finally {
@@ -846,10 +841,10 @@ public class ManagerServlet extends Http
                     if (war != null) {
                         if (war.endsWith(".war")) {
                             copy(new File(war), 
-                                    new File(getAppBase(), baseName + ".war"));
+                                    new File(host.getAppBaseFile(), baseName + 
".war"));
                         } else {
                             copy(new File(war), 
-                                    new File(getAppBase(), baseName));
+                                    new File(host.getAppBaseFile(), baseName));
                         }
                     }
                     // Perform new deployment
@@ -1352,8 +1347,8 @@ public class ManagerServlet extends Http
                     ExceptionUtils.handleThrowable(t);
                 }
                 try {
-                    File war = new File(getAppBase(), baseName + ".war");
-                    File dir = new File(getAppBase(), baseName);
+                    File war = new File(host.getAppBaseFile(), baseName + 
".war");
+                    File dir = new File(host.getAppBaseFile(), baseName);
                     File xml = new File(configBase, baseName + ".xml");
                     if (war.exists() && !war.delete()) {
                         writer.println(smClient.getString(
@@ -1390,30 +1385,6 @@ public class ManagerServlet extends Http
 
 
     /**
-     * Return a File object representing the "application root" directory
-     * for our associated Host.
-     */
-    protected File getAppBase() {
-
-        if (appBase != null) {
-            return appBase;
-        }
-
-        File file = new File(host.getAppBase());
-        if (!file.isAbsolute())
-            file = new File(System.getProperty(Globals.CATALINA_BASE_PROP),
-                            host.getAppBase());
-        try {
-            appBase = file.getCanonicalFile();
-        } catch (IOException e) {
-            appBase = file;
-        }
-        return (appBase);
-
-    }
-
-
-    /**
      * Invoke the isDeployed method on the deployer.
      */
     protected boolean isDeployed(String name) 

Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1157943&r1=1157942&r2=1157943&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Mon Aug 15 
18:50:25 2011
@@ -688,16 +688,7 @@ public class ContextConfig
         throws IOException {
         
         Host host = (Host) context.getParent();
-        String appBase = host.getAppBase();
-
-        File canonicalAppBase = new File(appBase);
-        if (canonicalAppBase.isAbsolute()) {
-            canonicalAppBase = canonicalAppBase.getCanonicalFile();
-        } else {
-            canonicalAppBase = 
-                new File(System.getProperty(Globals.CATALINA_BASE_PROP), 
appBase)
-                .getCanonicalFile();
-        }
+        File appBase = host.getAppBaseFile();
 
         String docBase = context.getDocBase();
         if (docBase == null) {
@@ -712,7 +703,7 @@ public class ContextConfig
 
         File file = new File(docBase);
         if (!file.isAbsolute()) {
-            docBase = (new File(canonicalAppBase, docBase)).getPath();
+            docBase = (new File(appBase, docBase)).getPath();
         } else {
             docBase = file.getCanonicalPath();
         }
@@ -727,7 +718,7 @@ public class ContextConfig
         if (host instanceof StandardHost) {
             unpackWARs = ((StandardHost) host).isUnpackWARs() &&
                     ((StandardContext) context).getUnpackWAR() &&
-                    (docBase.startsWith(canonicalAppBase.getPath()));
+                    (docBase.startsWith(host.getAppBaseFile().getPath()));
         }
 
         if (docBase.toLowerCase(Locale.ENGLISH).endsWith(".war") && 
!file.isDirectory() && unpackWARs) {
@@ -765,8 +756,8 @@ public class ContextConfig
             }
         }
 
-        if (docBase.startsWith(canonicalAppBase.getPath() + 
File.separatorChar)) {
-            docBase = docBase.substring(canonicalAppBase.getPath().length());
+        if (docBase.startsWith(appBase.getPath() + File.separatorChar)) {
+            docBase = docBase.substring(appBase.getPath().length());
             docBase = docBase.replace(File.separatorChar, '/');
             if (docBase.startsWith("/")) {
                 docBase = docBase.substring(1);
@@ -786,7 +777,6 @@ public class ContextConfig
             && ((StandardContext) context).getAntiResourceLocking()) {
             
             Host host = (Host) context.getParent();
-            String appBase = host.getAppBase();
             String docBase = context.getDocBase();
             if (docBase == null)
                 return;
@@ -797,11 +787,7 @@ public class ContextConfig
             }
             File docBaseFile = new File(docBase);
             if (!docBaseFile.isAbsolute()) {
-                File file = new File(appBase);
-                if (!file.isAbsolute()) {
-                    file = new 
File(System.getProperty(Globals.CATALINA_BASE_PROP), appBase);
-                }
-                docBaseFile = new File(file, docBase);
+                docBaseFile = new File(host.getAppBaseFile(), docBase);
             }
             
             String path = context.getPath();
@@ -1077,12 +1063,11 @@ public class ContextConfig
 
         // Remove (partially) folders and files created by antiLocking
         Host host = (Host) context.getParent();
-        String appBase = host.getAppBase();
         String docBase = context.getDocBase();
         if ((docBase != null) && (originalDocBase != null)) {
             File docBaseFile = new File(docBase);
             if (!docBaseFile.isAbsolute()) {
-                docBaseFile = new File(appBase, docBase);
+                docBaseFile = new File(host.getAppBaseFile(), docBase);
             }
             // No need to log failure - it is expected in this case
             ExpandWar.delete(docBaseFile, false);

Modified: tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java?rev=1157943&r1=1157942&r2=1157943&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java Mon Aug 15 
18:50:25 2011
@@ -31,7 +31,6 @@ import java.util.Enumeration;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 
-import org.apache.catalina.Globals;
 import org.apache.catalina.Host;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -77,18 +76,7 @@ public class ExpandWar {
         throws IOException {
 
         // Make sure that there is no such directory already existing
-        File appBase = new File(host.getAppBase());
-        if (!appBase.isAbsolute()) {
-            appBase = new File(System.getProperty(Globals.CATALINA_BASE_PROP),
-                               host.getAppBase());
-        }
-        if (!appBase.exists() || !appBase.isDirectory()) {
-            throw new IOException
-                (sm.getString("hostConfig.appBase",
-                              appBase.getAbsolutePath()));
-        }
-        
-        File docBase = new File(appBase, pathname);
+        File docBase = new File(host.getAppBaseFile(), pathname);
         if (docBase.exists()) {
             // War file is already installed
             return (docBase.getAbsolutePath());
@@ -193,14 +181,7 @@ public class ExpandWar {
     public static void validate(Host host, URL war, String pathname)
         throws IOException {
 
-        // Make the appBase absolute
-        File appBase = new File(host.getAppBase());
-        if (!appBase.isAbsolute()) {
-            appBase = new File(System.getProperty(Globals.CATALINA_BASE_PROP),
-                               host.getAppBase());
-        }
-        
-        File docBase = new File(appBase, pathname);
+        File docBase = new File(host.getAppBaseFile(), pathname);
 
         // Calculate the document base directory
         String canonicalDocBasePrefix = docBase.getCanonicalPath();

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=1157943&r1=1157942&r2=1157943&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java Mon Aug 15 
18:50:25 2011
@@ -78,12 +78,6 @@ public class HostConfig
 
 
     /**
-     * App base.
-     */
-    protected File appBase = null;
-
-
-    /**
      * Config base.
      */
     protected File configBase = null;
@@ -404,22 +398,6 @@ public class HostConfig
     
 
     /**
-     * Return a File object representing the "application root" directory
-     * for our associated Host.
-     */
-    protected File appBase() {
-
-        if (appBase != null) {
-            return appBase;
-        }
-        
-        appBase = returnCanonicalPath(host.getAppBase());
-        return appBase;
-
-    }
-
-
-    /**
      * Return a File object representing the "configuration root" directory
      * for our associated Host.
      */
@@ -461,7 +439,7 @@ public class HostConfig
      */
     protected void deployApps() {
 
-        File appBase = appBase();
+        File appBase = host.getAppBaseFile();
         File configBase = configBase();
         String[] filteredAppPaths = filterAppPaths(appBase.list());
         // Deploy XML descriptors from configBase
@@ -514,7 +492,7 @@ public class HostConfig
      */
     protected void deployApps(String name) {
 
-        File appBase = appBase();
+        File appBase = host.getAppBaseFile();
         File configBase = configBase();
         ContextName cn = new ContextName(name);
         String baseName = cn.getBaseName();
@@ -609,11 +587,11 @@ public class HostConfig
             if (context.getDocBase() != null) {
                 File docBase = new File(context.getDocBase());
                 if (!docBase.isAbsolute()) {
-                    docBase = new File(appBase(), context.getDocBase());
+                    docBase = new File(host.getAppBaseFile(), 
context.getDocBase());
                 }
                 // If external docBase, register .xml as redeploy first
                 if (!docBase.getCanonicalPath().startsWith(
-                        appBase().getAbsolutePath() + File.separator)) {
+                        host.getAppBaseFile().getAbsolutePath() + 
File.separator)) {
                     isExternal = true;
                     deployedApp.redeployResources.put(
                             contextXml.getAbsolutePath(),
@@ -634,13 +612,13 @@ public class HostConfig
             // Get paths for WAR and expanded WAR in appBase
 
             // default to appBase dir + name
-            File expandedDocBase = new File(appBase(), cn.getBaseName());
+            File expandedDocBase = new File(host.getAppBaseFile(), 
cn.getBaseName());
             if (context.getDocBase() != null) {
                 // first assume docBase is absolute
                 expandedDocBase = new File(context.getDocBase());
                 if (!expandedDocBase.isAbsolute()) {
                     // if docBase specified and relative, it must be relative 
to appBase
-                    expandedDocBase = new File(appBase(), 
context.getDocBase());
+                    expandedDocBase = new File(host.getAppBaseFile(), 
context.getDocBase());
                 }
             }
             // Add the eventual unpacked WAR and all the resources which will 
be
@@ -782,7 +760,7 @@ public class HostConfig
             xml = new File(configBase(),
                     file.substring(0, file.lastIndexOf(".")) + ".xml");
         } else {
-            xml = new File(appBase(),
+            xml = new File(host.getAppBaseFile(),
                     file.substring(0, file.lastIndexOf(".")) +
                     "/META-INF/context.xml");
         }
@@ -933,7 +911,7 @@ public class HostConfig
             // If we're unpacking WARs, the docBase will be mutated after
             // starting the context
             if (unpackWARs && (context.getDocBase() != null)) {
-                File docBase = new File(appBase(), cn.getBaseName());
+                File docBase = new File(host.getAppBaseFile(), 
cn.getBaseName());
                 deployedApp.redeployResources.put(docBase.getAbsolutePath(),
                         Long.valueOf(docBase.lastModified()));
                 addWatchedResources(deployedApp, docBase.getAbsolutePath(),
@@ -1102,7 +1080,7 @@ public class HostConfig
         if (docBase != null) {
             docBaseFile = new File(docBase);
             if (!docBaseFile.isAbsolute()) {
-                docBaseFile = new File(appBase(), docBase);
+                docBaseFile = new File(host.getAppBaseFile(), docBase);
             }
         }
         String[] watchedResources = context.findWatchedResources();
@@ -1161,7 +1139,7 @@ public class HostConfig
                             File current = new File(resources[j]);
                             current = current.getCanonicalFile();
                             if ((current.getAbsolutePath().startsWith(
-                                    appBase().getAbsolutePath() +
+                                    host.getAppBaseFile().getAbsolutePath() +
                                     File.separator))
                                     || (current.getAbsolutePath().startsWith(
                                             configBase().getAbsolutePath()))) {
@@ -1212,7 +1190,7 @@ public class HostConfig
                         File current = new File(resources[j]);
                         current = current.getCanonicalFile();
                         if ((current.getAbsolutePath().startsWith(
-                                appBase().getAbsolutePath() + File.separator))
+                                host.getAppBaseFile().getAbsolutePath() + 
File.separator))
                             || (current.getAbsolutePath().startsWith(
                                     configBase().getAbsolutePath()))) {
                             if (log.isDebugEnabled())
@@ -1233,7 +1211,7 @@ public class HostConfig
                         File current = new File(resources2[j]);
                         current = current.getCanonicalFile();
                         if ((current.getAbsolutePath().startsWith(
-                                appBase().getAbsolutePath() + File.separator))
+                                host.getAppBaseFile().getAbsolutePath() + 
File.separator))
                             || ((current.getAbsolutePath().startsWith(
                                     configBase().getAbsolutePath())
                                  && 
(current.getAbsolutePath().endsWith(".xml"))))) {
@@ -1310,7 +1288,7 @@ public class HostConfig
         }
         
         if (host.getCreateDirs()) {
-            File[] dirs = new File[] {appBase(),configBase()};
+            File[] dirs = new File[] {host.getAppBaseFile(),configBase()};
             for (int i=0; i<dirs.length; i++) {
                 if ( (!dirs[i].isDirectory()) && (!dirs[i].mkdirs())) {
                     log.error(sm.getString("hostConfig.createDirs",dirs[i]));
@@ -1318,9 +1296,9 @@ public class HostConfig
             }
         }
 
-        if (!appBase().isDirectory()) {
-            log.error(sm.getString(
-                    "hostConfig.appBase", host.getName(), 
appBase().getPath()));
+        if (!host.getAppBaseFile().isDirectory()) {
+            log.error(sm.getString("hostConfig.appBase", host.getName(),
+                    host.getAppBaseFile().getPath()));
             host.setDeployOnStartup(false);
             host.setAutoDeploy(false);
         }
@@ -1347,7 +1325,6 @@ public class HostConfig
             }
         }
         oname = null;
-        appBase = null;
         configBase = null;
 
     }
@@ -1403,7 +1380,7 @@ public class HostConfig
         if (context.getDocBase() != null) {
             File docBase = new File(context.getDocBase());
             if (!docBase.isAbsolute()) {
-                docBase = new File(appBase(), context.getDocBase());
+                docBase = new File(host.getAppBaseFile(), 
context.getDocBase());
             }
             deployedApp.redeployResources.put(docBase.getAbsolutePath(),
                     Long.valueOf(docBase.lastModified()));
@@ -1415,7 +1392,7 @@ public class HostConfig
         // Add the eventual unpacked WAR and all the resources which will be
         // watched inside it
         if (isWar && unpackWARs) {
-            File docBase = new File(appBase(), context.getBaseName());
+            File docBase = new File(host.getAppBaseFile(), 
context.getBaseName());
             deployedApp.redeployResources.put(docBase.getAbsolutePath(),
                         Long.valueOf(docBase.lastModified()));
             addWatchedResources(deployedApp, docBase.getAbsolutePath(), 
context);

Modified: tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java?rev=1157943&r1=1157942&r2=1157943&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java 
(original)
+++ tomcat/trunk/test/org/apache/catalina/core/TestStandardContext.java Mon Aug 
15 18:50:25 2011
@@ -75,7 +75,7 @@ public class TestStandardContext extends
         // Set up a container
         Tomcat tomcat = getTomcatInstance();
         
-        File docBase = new File(tomcat.getHost().getAppBase(), "ROOT");
+        File docBase = new File(tomcat.getHost().getAppBaseFile(), "ROOT");
         if (!docBase.exists() && !docBase.mkdirs()) {
             fail("Unable to create docBase");
         }

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1157943&r1=1157942&r2=1157943&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Aug 15 18:50:25 2011
@@ -47,6 +47,14 @@
   should be listed here.
 -->
 <section name="Tomcat 8.0.0">
+  <subsection name="Catalina">
+    <changelog>
+      <scode>
+        Remove duplicate code that converted a Host&apos;s appBase attribute to
+        a canonical file. (markt)
+      </scode>
+    </changelog>
+  </subsection>
 </section>
 </body>
 </document>



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

Reply via email to