tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r991959 - in /tomcat/trunk: java/org/apache/catalina/ java/org/apache/catalina/connector/ java/org/apache/catalina/core/ java/org/apache/catalina/ha/deploy/ java/org/apache/catalina/manager/ java/org/apache/catalina/manager/host/ java/org/a...
Date Thu, 02 Sep 2010 14:52:13 GMT
Author: rjung
Date: Thu Sep  2 14:52:11 2010
New Revision: 991959

URL: http://svn.apache.org/viewvc?rev=991959&view=rev
Log:
BZ 48967: Replace strings "catalina.base" and "catalina.home"
by globally defined constants.

Patch provided by Marc Guillemot.

Modified:
    tomcat/trunk/java/org/apache/catalina/Globals.java
    tomcat/trunk/java/org/apache/catalina/connector/Connector.java
    tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
    tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
    tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java
    tomcat/trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java
    tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
    tomcat/trunk/java/org/apache/catalina/realm/MemoryRealm.java
    tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java
    tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
    tomcat/trunk/java/org/apache/catalina/startup/CatalinaProperties.java
    tomcat/trunk/java/org/apache/catalina/startup/Embedded.java
    tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java
    tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
    tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java
    tomcat/trunk/java/org/apache/catalina/startup/Tool.java
    tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java
    tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java
    tomcat/trunk/java/org/apache/jasper/compiler/AntCompiler.java
    tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
    tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/Globals.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Globals.java?rev=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/Globals.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Globals.java Thu Sep  2 14:52:11 2010
@@ -329,4 +329,16 @@ public final class Globals {
      * Default domain for MBeans if none can be determined
      */
     public static final String DEFAULT_MBEAN_DOMAIN = "Catalina";
+
+    /**
+     * Name of the system property containing
+     * the tomcat product installation path
+     */
+    public static final String CATALINA_HOME_PROP = "catalina.home";
+
+    /**
+     * Name of the system property containing
+     * the tomcat instance installation path
+     */
+    public static final String CATALINA_BASE_PROP = "catalina.base";
 }

Modified: tomcat/trunk/java/org/apache/catalina/connector/Connector.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Connector.java?rev=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Connector.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Connector.java Thu Sep  2 14:52:11 2010
@@ -22,6 +22,7 @@ import java.util.HashMap;
 
 import javax.management.ObjectName;
 
+import org.apache.catalina.Globals;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.Service;
@@ -857,7 +858,7 @@ public class Connector extends Lifecycle
         protocolHandler.setAdapter(adapter);
 
         IntrospectionUtils.setProperty(protocolHandler, "jkHome",
-                                       System.getProperty("catalina.base"));
+                                       System.getProperty(Globals.CATALINA_BASE_PROP));
 
         try {
             protocolHandler.init();

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=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Thu Sep  2 14:52:11 2010
@@ -5138,7 +5138,7 @@ public class StandardContext extends Con
      * entire servlet container (i.e. the Engine container if present).
      */
     protected File engineBase() {
-        String base=System.getProperty("catalina.base");
+        String base=System.getProperty(Globals.CATALINA_BASE_PROP);
         if( base == null ) {
             StandardEngine eng=(StandardEngine)this.getParent().getParent();
             base=eng.getBaseDir();
@@ -5257,7 +5257,7 @@ public class StandardContext extends Con
      */
     public File getConfigBase() {
         File configBase = 
-            new File(System.getProperty("catalina.base"), "conf");
+            new File(System.getProperty(Globals.CATALINA_BASE_PROP), "conf");
         if (!configBase.exists()) {
             return null;
         }

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=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java Thu Sep  2 14:52:11
2010
@@ -28,6 +28,7 @@ import javax.management.ObjectName;
 import org.apache.catalina.Container;
 import org.apache.catalina.Context;
 import org.apache.catalina.Engine;
+import org.apache.catalina.Globals;
 import org.apache.catalina.Host;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.ha.CatalinaCluster;
@@ -172,7 +173,7 @@ public class FarmWarDeployer extends Clu
             }
         }
          
-        configBase = new File(System.getProperty("catalina.base"), "conf");
+        configBase = new File(System.getProperty(Globals.CATALINA_BASE_PROP), "conf");
         if (engine != null) {
             configBase = new File(configBase, engine.getName());
         } 
@@ -537,7 +538,7 @@ public class FarmWarDeployer extends Clu
 
         File file = new File(host.getAppBase());
         if (!file.isAbsolute())
-            file = new File(System.getProperty("catalina.base"), host
+            file = new File(System.getProperty(Globals.CATALINA_BASE_PROP), host
                     .getAppBase());
         try {
             appBase = file.getCanonicalFile();

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=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/manager/ManagerServlet.java Thu Sep  2 14:52:11
2010
@@ -45,6 +45,7 @@ import org.apache.catalina.Container;
 import org.apache.catalina.ContainerServlet;
 import org.apache.catalina.Context;
 import org.apache.catalina.Engine;
+import org.apache.catalina.Globals;
 import org.apache.catalina.Host;
 import org.apache.catalina.Manager;
 import org.apache.catalina.Role;
@@ -461,10 +462,10 @@ public class ManagerServlet
         String appBase = ((Host) context.getParent()).getAppBase();
         deployed = new File(appBase);
         if (!deployed.isAbsolute()) {
-            deployed = new File(System.getProperty("catalina.base"),
+            deployed = new File(System.getProperty(Globals.CATALINA_BASE_PROP),
                                 appBase);
         }
-        configBase = new File(System.getProperty("catalina.base"), "conf");
+        configBase = new File(System.getProperty(Globals.CATALINA_BASE_PROP), "conf");
         Container container = context;
         Container host = null;
         Container engine = null;
@@ -1425,7 +1426,7 @@ public class ManagerServlet
 
         File file = new File(host.getAppBase());
         if (!file.isAbsolute())
-            file = new File(System.getProperty("catalina.base"),
+            file = new File(System.getProperty(Globals.CATALINA_BASE_PROP),
                             host.getAppBase());
         try {
             appBase = file.getCanonicalFile();

Modified: tomcat/trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java?rev=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/manager/host/HostManagerServlet.java Thu Sep  2
14:52:11 2010
@@ -38,6 +38,7 @@ import org.apache.catalina.Container;
 import org.apache.catalina.ContainerServlet;
 import org.apache.catalina.Context;
 import org.apache.catalina.Engine;
+import org.apache.catalina.Globals;
 import org.apache.catalina.Host;
 import org.apache.catalina.Wrapper;
 import org.apache.catalina.core.ContainerBase;
@@ -364,7 +365,7 @@ public class HostManagerServlet
             file = new File(appBase);
         }
         if (!file.isAbsolute())
-            file = new File(System.getProperty("catalina.base"), file.getPath());
+            file = new File(System.getProperty(Globals.CATALINA_BASE_PROP), file.getPath());
         try {
             appBaseFile = file.getCanonicalFile();
         } catch (IOException e) {
@@ -674,7 +675,7 @@ public class HostManagerServlet
      */
     protected File getConfigBase(String hostName) {
         File configBase = 
-            new File(System.getProperty("catalina.base"), "conf");
+            new File(System.getProperty(Globals.CATALINA_BASE_PROP), "conf");
         if (!configBase.exists()) {
             return null;
         }

Modified: tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java?rev=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java (original)
+++ tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java Thu Sep  2 14:52:11
2010
@@ -35,6 +35,7 @@ import javax.security.auth.login.FailedL
 import javax.security.auth.login.LoginException;
 import javax.security.auth.spi.LoginModule;
 
+import org.apache.catalina.Globals;
 import org.apache.catalina.authenticator.Constants;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -339,7 +340,7 @@ public class JAASMemoryLoginModule exten
         // Validate the existence of our configuration file
         File file = new File(pathname);
         if (!file.isAbsolute())
-            file = new File(System.getProperty("catalina.base"), pathname);
+            file = new File(System.getProperty(Globals.CATALINA_BASE_PROP), pathname);
         if (!file.exists() || !file.canRead()) {
             log.warn("Cannot load configuration file " + file.getAbsolutePath());
             return;

Modified: tomcat/trunk/java/org/apache/catalina/realm/MemoryRealm.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/MemoryRealm.java?rev=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/realm/MemoryRealm.java (original)
+++ tomcat/trunk/java/org/apache/catalina/realm/MemoryRealm.java Thu Sep  2 14:52:11 2010
@@ -25,6 +25,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.catalina.Globals;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.util.LifecycleBase;
 import org.apache.juli.logging.Log;
@@ -289,7 +290,7 @@ public class MemoryRealm  extends RealmB
         // Validate the existence of our database file
         File file = new File(pathname);
         if (!file.isAbsolute())
-            file = new File(System.getProperty("catalina.base"), pathname);
+            file = new File(System.getProperty(Globals.CATALINA_BASE_PROP), pathname);
         if (!file.exists() || !file.canRead())
             throw new LifecycleException
                 (sm.getString("memoryRealm.loadExist",

Modified: tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java?rev=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/Bootstrap.java Thu Sep  2 14:52:11 2010
@@ -31,6 +31,7 @@ import javax.management.MBeanServer;
 import javax.management.MBeanServerFactory;
 import javax.management.ObjectName;
 
+import org.apache.catalina.Globals;
 import org.apache.catalina.security.SecurityClassLoad;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -57,8 +58,8 @@ public final class Bootstrap {
     // -------------------------------------------------------------- Constants
 
 
-    protected static final String CATALINA_HOME_TOKEN = "${catalina.home}";
-    protected static final String CATALINA_BASE_TOKEN = "${catalina.base}";
+    protected static final String CATALINA_HOME_TOKEN = "${" + Globals.CATALINA_HOME_PROP
+ "}";
+    protected static final String CATALINA_BASE_TOKEN = "${" + Globals.CATALINA_BASE_PROP
+ "}";
 
 
     // ------------------------------------------------------- Static Variables
@@ -425,11 +426,11 @@ public final class Bootstrap {
     }
 
     public void setCatalinaHome(String s) {
-        System.setProperty( "catalina.home", s );
+        System.setProperty(Globals.CATALINA_HOME_PROP, s);
     }
 
     public void setCatalinaBase(String s) {
-        System.setProperty( "catalina.base", s );
+        System.setProperty(Globals.CATALINA_BASE_PROP, s);
     }
 
 
@@ -439,13 +440,13 @@ public final class Bootstrap {
      */
     private void setCatalinaBase() {
 
-        if (System.getProperty("catalina.base") != null)
+        if (System.getProperty(Globals.CATALINA_BASE_PROP) != null)
             return;
-        if (System.getProperty("catalina.home") != null)
-            System.setProperty("catalina.base",
-                               System.getProperty("catalina.home"));
+        if (System.getProperty(Globals.CATALINA_HOME_PROP) != null)
+            System.setProperty(Globals.CATALINA_BASE_PROP,
+                               System.getProperty(Globals.CATALINA_HOME_PROP));
         else
-            System.setProperty("catalina.base",
+            System.setProperty(Globals.CATALINA_BASE_PROP,
                                System.getProperty("user.dir"));
 
     }
@@ -457,23 +458,23 @@ public final class Bootstrap {
      */
     private void setCatalinaHome() {
 
-        if (System.getProperty("catalina.home") != null)
+        if (System.getProperty(Globals.CATALINA_HOME_PROP) != null)
             return;
         File bootstrapJar = 
             new File(System.getProperty("user.dir"), "bootstrap.jar");
         if (bootstrapJar.exists()) {
             try {
                 System.setProperty
-                    ("catalina.home", 
+                    (Globals.CATALINA_HOME_PROP, 
                      (new File(System.getProperty("user.dir"), ".."))
                      .getCanonicalPath());
             } catch (Exception e) {
                 // Ignore
-                System.setProperty("catalina.home",
+                System.setProperty(Globals.CATALINA_HOME_PROP,
                                    System.getProperty("user.dir"));
             }
         } else {
-            System.setProperty("catalina.home",
+            System.setProperty(Globals.CATALINA_HOME_PROP,
                                System.getProperty("user.dir"));
         }
 
@@ -484,7 +485,7 @@ public final class Bootstrap {
      * Get the value of the catalina.home environment variable.
      */
     public static String getCatalinaHome() {
-        return System.getProperty("catalina.home",
+        return System.getProperty(Globals.CATALINA_HOME_PROP,
                                   System.getProperty("user.dir"));
     }
 
@@ -493,7 +494,7 @@ public final class Bootstrap {
      * Get the value of the catalina.base environment variable.
      */
     public static String getCatalinaBase() {
-        return System.getProperty("catalina.base", getCatalinaHome());
+        return System.getProperty(Globals.CATALINA_BASE_PROP, getCatalinaHome());
     }
 
 

Modified: tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Catalina.java?rev=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/Catalina.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/Catalina.java Thu Sep  2 14:52:11 2010
@@ -31,6 +31,7 @@ import java.util.List;
 import java.util.logging.LogManager;
 
 import org.apache.catalina.Container;
+import org.apache.catalina.Globals;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.Server;
 import org.apache.catalina.core.StandardServer;
@@ -268,7 +269,7 @@ public class Catalina {
 
         File file = new File(configFile);
         if (!file.isAbsolute())
-            file = new File(System.getProperty("catalina.base"), configFile);
+            file = new File(System.getProperty(Globals.CATALINA_BASE_PROP), configFile);
         return (file);
 
     }
@@ -681,21 +682,21 @@ public class Catalina {
 
     protected void initDirs() {
 
-        String catalinaHome = System.getProperty("catalina.home");
+        String catalinaHome = System.getProperty(Globals.CATALINA_HOME_PROP);
         if (catalinaHome == null) {
             // Backwards compatibility patch for J2EE RI 1.3
             String j2eeHome = System.getProperty("com.sun.enterprise.home");
             if (j2eeHome != null) {
                 catalinaHome=System.getProperty("com.sun.enterprise.home");
-            } else if (System.getProperty("catalina.base") != null) {
-                catalinaHome = System.getProperty("catalina.base");
+            } else if (System.getProperty(Globals.CATALINA_BASE_PROP) != null) {
+                catalinaHome = System.getProperty(Globals.CATALINA_BASE_PROP);
             } else {
                 // Use IntrospectionUtils and guess the dir
                 catalinaHome = IntrospectionUtils.guessInstall
-                    ("catalina.home", "catalina.base", "catalina.jar");
+                    (Globals.CATALINA_HOME_PROP, Globals.CATALINA_BASE_PROP, "catalina.jar");
                 if (catalinaHome == null) {
                     catalinaHome = IntrospectionUtils.guessInstall
-                        ("tomcat.install", "catalina.home", "tomcat.jar");
+                        ("tomcat.install", Globals.CATALINA_HOME_PROP, "tomcat.jar");
                 }
             }
         }
@@ -712,14 +713,14 @@ public class Catalina {
                     catalinaHome = home.getAbsolutePath();
                 }
             }
-            System.setProperty("catalina.home", catalinaHome);
+            System.setProperty(Globals.CATALINA_HOME_PROP, catalinaHome);
         }
 
-        if (System.getProperty("catalina.base") == null) {
-            System.setProperty("catalina.base",
+        if (System.getProperty(Globals.CATALINA_BASE_PROP) == null) {
+            System.setProperty(Globals.CATALINA_BASE_PROP,
                                catalinaHome);
         } else {
-            String catalinaBase = System.getProperty("catalina.base");
+            String catalinaBase = System.getProperty(Globals.CATALINA_BASE_PROP);
             File base = new File(catalinaBase);
             if (!base.isAbsolute()) {
                 try {
@@ -728,7 +729,7 @@ public class Catalina {
                     catalinaBase = base.getAbsolutePath();
                 }
             }
-            System.setProperty("catalina.base", catalinaBase);
+            System.setProperty(Globals.CATALINA_BASE_PROP, catalinaBase);
         }
         
         String temp = System.getProperty("java.io.tmpdir");

Modified: tomcat/trunk/java/org/apache/catalina/startup/CatalinaProperties.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/CatalinaProperties.java?rev=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/CatalinaProperties.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/CatalinaProperties.java Thu Sep  2 14:52:11
2010
@@ -25,6 +25,7 @@ import java.net.URL;
 import java.util.Enumeration;
 import java.util.Properties;
 
+import org.apache.catalina.Globals;
 import org.apache.tomcat.util.ExceptionUtils;
 
 
@@ -87,6 +88,11 @@ public class CatalinaProperties {
         InputStream is = null;
         Throwable error = null;
 
+        ClassLoader cl = CatalinaProperties.class.getClassLoader();
+        System.err.println("CatalinaProprties: cl=" + cl.toString());
+        if ((cl = cl.getParent()) != null) {
+            System.err.println("CatalinaProprties: parent cl=" + cl.toString());
+        }
         try {
             String configUrl = getConfigUrl();
             if (configUrl != null) {
@@ -150,7 +156,7 @@ public class CatalinaProperties {
      * Get the value of the catalina.home environment variable.
      */
     private static String getCatalinaHome() {
-        return System.getProperty("catalina.home",
+        return System.getProperty(Globals.CATALINA_HOME_PROP,
                                   System.getProperty("user.dir"));
     }
     
@@ -159,7 +165,7 @@ public class CatalinaProperties {
      * Get the value of the catalina.base environment variable.
      */
     private static String getCatalinaBase() {
-        return System.getProperty("catalina.base", getCatalinaHome());
+        return System.getProperty(Globals.CATALINA_BASE_PROP, getCatalinaHome());
     }
 
 

Modified: tomcat/trunk/java/org/apache/catalina/startup/Embedded.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Embedded.java?rev=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/Embedded.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/Embedded.java Thu Sep  2 14:52:11 2010
@@ -28,6 +28,7 @@ import org.apache.catalina.Authenticator
 import org.apache.catalina.Container;
 import org.apache.catalina.Context;
 import org.apache.catalina.Engine;
+import org.apache.catalina.Globals;
 import org.apache.catalina.Host;
 import org.apache.catalina.Lifecycle;
 import org.apache.catalina.LifecycleException;
@@ -282,20 +283,20 @@ public class Embedded  extends StandardS
         return await;
     }
 
-    public void setCatalinaHome( String s ) {
-        System.setProperty( "catalina.home", s);
+    public void setCatalinaHome(String s) {
+        System.setProperty(Globals.CATALINA_HOME_PROP, s);
     }
 
-    public void setCatalinaBase( String s ) {
-        System.setProperty( "catalina.base", s);
+    public void setCatalinaBase(String s) {
+        System.setProperty(Globals.CATALINA_BASE_PROP, s);
     }
 
     public String getCatalinaHome() {
-        return System.getProperty("catalina.home");
+        return System.getProperty(Globals.CATALINA_HOME_PROP);
     }
 
     public String getCatalinaBase() {
-        return System.getProperty("catalina.base");
+        return System.getProperty(Globals.CATALINA_BASE_PROP);
     }
 
 
@@ -902,21 +903,21 @@ public class Embedded  extends StandardS
 
     protected void initDirs() {
 
-        String catalinaHome = System.getProperty("catalina.home");
+        String catalinaHome = System.getProperty(Globals.CATALINA_HOME_PROP);
         if (catalinaHome == null) {
             // Backwards compatibility patch for J2EE RI 1.3
             String j2eeHome = System.getProperty("com.sun.enterprise.home");
             if (j2eeHome != null) {
                 catalinaHome=System.getProperty("com.sun.enterprise.home");
-            } else if (System.getProperty("catalina.base") != null) {
-                catalinaHome = System.getProperty("catalina.base");
+            } else if (System.getProperty(Globals.CATALINA_BASE_PROP) != null) {
+                catalinaHome = System.getProperty(Globals.CATALINA_BASE_PROP);
             } else {
                 // Use IntrospectionUtils and guess the dir
                 catalinaHome = IntrospectionUtils.guessInstall
-                    ("catalina.home", "catalina.base", "catalina.jar");
+                    (Globals.CATALINA_HOME_PROP, Globals.CATALINA_BASE_PROP, "catalina.jar");
                 if (catalinaHome == null) {
                     catalinaHome = IntrospectionUtils.guessInstall
-                        ("tomcat.install", "catalina.home", "tomcat.jar");
+                        ("tomcat.install", Globals.CATALINA_HOME_PROP, "tomcat.jar");
                 }
             }
         }
@@ -933,14 +934,14 @@ public class Embedded  extends StandardS
                     catalinaHome = home.getAbsolutePath();
                 }
             }
-            System.setProperty("catalina.home", catalinaHome);
+            System.setProperty(Globals.CATALINA_HOME_PROP, catalinaHome);
         }
 
-        if (System.getProperty("catalina.base") == null) {
-            System.setProperty("catalina.base",
+        if (System.getProperty(Globals.CATALINA_BASE_PROP) == null) {
+            System.setProperty(Globals.CATALINA_BASE_PROP,
                                catalinaHome);
         } else {
-            String catalinaBase = System.getProperty("catalina.base");
+            String catalinaBase = System.getProperty(Globals.CATALINA_BASE_PROP);
             File base = new File(catalinaBase);
             if (!base.isAbsolute()) {
                 try {
@@ -949,7 +950,7 @@ public class Embedded  extends StandardS
                     catalinaBase = base.getAbsolutePath();
                 }
             }
-            System.setProperty("catalina.base", catalinaBase);
+            System.setProperty(Globals.CATALINA_BASE_PROP, catalinaBase);
         }
         
         String temp = System.getProperty("java.io.tmpdir");

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=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java Thu Sep  2 14:52:11 2010
@@ -31,6 +31,7 @@ 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;
@@ -78,7 +79,7 @@ public class ExpandWar {
         // Make sure that there is no such directory already existing
         File appBase = new File(host.getAppBase());
         if (!appBase.isAbsolute()) {
-            appBase = new File(System.getProperty("catalina.base"),
+            appBase = new File(System.getProperty(Globals.CATALINA_BASE_PROP),
                                host.getAppBase());
         }
         if (!appBase.exists() || !appBase.isDirectory()) {
@@ -193,7 +194,7 @@ public class ExpandWar {
         // Make the appBase absolute
         File appBase = new File(host.getAppBase());
         if (!appBase.isAbsolute()) {
-            appBase = new File(System.getProperty("catalina.base"),
+            appBase = new File(System.getProperty(Globals.CATALINA_BASE_PROP),
                                host.getAppBase());
         }
         

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=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java Thu Sep  2 14:52:11 2010
@@ -41,6 +41,7 @@ import javax.management.ObjectName;
 import org.apache.catalina.Container;
 import org.apache.catalina.Context;
 import org.apache.catalina.Engine;
+import org.apache.catalina.Globals;
 import org.apache.catalina.Host;
 import org.apache.catalina.Lifecycle;
 import org.apache.catalina.LifecycleEvent;
@@ -437,7 +438,7 @@ public class HostConfig
     
     protected File returnCanonicalPath(String path) {
         File file = new File(path);
-        File base = new File(System.getProperty("catalina.base"));
+        File base = new File(System.getProperty(Globals.CATALINA_BASE_PROP));
         if (!file.isAbsolute())
             file = new File(base,path);
         try {

Modified: tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java?rev=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java Thu Sep  2 14:52:11 2010
@@ -32,6 +32,7 @@ import javax.servlet.ServletException;
 import org.apache.catalina.Container;
 import org.apache.catalina.Context;
 import org.apache.catalina.Engine;
+import org.apache.catalina.Globals;
 import org.apache.catalina.Host;
 import org.apache.catalina.Lifecycle;
 import org.apache.catalina.LifecycleEvent;
@@ -539,10 +540,10 @@ public class Tomcat {
     
     protected void initBaseDir() {
         if (basedir == null) {
-            basedir = System.getProperty("catalina.base");
+            basedir = System.getProperty(Globals.CATALINA_BASE_PROP);
         }
         if (basedir == null) {
-            basedir = System.getProperty("catalina.home");
+            basedir = System.getProperty(Globals.CATALINA_HOME_PROP);
         }
         if (basedir == null) {
             // Create a temp dir.
@@ -558,8 +559,8 @@ public class Tomcat {
                 }
             }
         }
-        System.setProperty("catalina.home", basedir);
-        System.setProperty("catalina.base", basedir);
+        System.setProperty(Globals.CATALINA_HOME_PROP, basedir);
+        System.setProperty(Globals.CATALINA_BASE_PROP, basedir);
     }
 
     static String[] silences = new String[] {

Modified: tomcat/trunk/java/org/apache/catalina/startup/Tool.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Tool.java?rev=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/Tool.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/Tool.java Thu Sep  2 14:52:11 2010
@@ -23,6 +23,7 @@ import java.io.File;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 
+import org.apache.catalina.Globals;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 
@@ -87,7 +88,7 @@ public final class Tool {
     /**
      * The pathname of our installation base directory.
      */
-    private static String catalinaHome = System.getProperty("catalina.home");
+    private static String catalinaHome = System.getProperty(Globals.CATALINA_HOME_PROP);
 
 
     /**
@@ -120,7 +121,7 @@ public final class Tool {
 
         // Verify that "catalina.home" was passed.
         if (catalinaHome == null) {
-            log.error("Must set 'catalina.home' system property");
+            log.error("Must set '" + Globals.CATALINA_HOME_PROP + "' system property");
             System.exit(1);
         }
 

Modified: tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java?rev=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java Thu Sep  2 14:52:11
2010
@@ -28,6 +28,7 @@ import java.io.PrintWriter;
 import java.util.HashMap;
 import java.util.Iterator;
 
+import org.apache.catalina.Globals;
 import org.apache.catalina.Group;
 import org.apache.catalina.Role;
 import org.apache.catalina.User;
@@ -379,7 +380,7 @@ public class MemoryUserDatabase implemen
                 // Construct a reader for the XML input file (if it exists)
                 File file = new File(pathname);
                 if (!file.isAbsolute()) {
-                    file = new File(System.getProperty("catalina.base"),
+                    file = new File(System.getProperty(Globals.CATALINA_BASE_PROP),
                                     pathname);
                 }
                 if (!file.exists()) {
@@ -491,7 +492,7 @@ public class MemoryUserDatabase implemen
 
         File file = new File(pathname);
         if (!file.isAbsolute()) {
-            file = new File(System.getProperty("catalina.base"),
+            file = new File(System.getProperty(Globals.CATALINA_BASE_PROP),
                             pathname);
         }
         File dir = file.getParentFile();
@@ -522,7 +523,7 @@ public class MemoryUserDatabase implemen
         File fileNew = new File(pathnameNew);
         if (!fileNew.isAbsolute()) {
             fileNew =
-                new File(System.getProperty("catalina.base"), pathnameNew);
+                new File(System.getProperty(Globals.CATALINA_BASE_PROP), pathnameNew);
         }
         PrintWriter writer = null;
         try {
@@ -578,13 +579,13 @@ public class MemoryUserDatabase implemen
         File fileOld = new File(pathnameOld);
         if (!fileOld.isAbsolute()) {
             fileOld =
-                new File(System.getProperty("catalina.base"), pathnameOld);
+                new File(System.getProperty(Globals.CATALINA_BASE_PROP), pathnameOld);
         }
         fileOld.delete();
         File fileOrig = new File(pathname);
         if (!fileOrig.isAbsolute()) {
             fileOrig =
-                new File(System.getProperty("catalina.base"), pathname);
+                new File(System.getProperty(Globals.CATALINA_BASE_PROP), pathname);
         }
         if (fileOrig.exists()) {
             fileOld.delete();

Modified: tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java?rev=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java Thu Sep  2 14:52:11 2010
@@ -37,6 +37,7 @@ import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpSession;
 
 import org.apache.catalina.AccessLog;
+import org.apache.catalina.Globals;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Request;
@@ -724,7 +725,7 @@ public class AccessLogValve extends Valv
         // Create the directory if necessary
         File dir = new File(directory);
         if (!dir.isAbsolute())
-            dir = new File(System.getProperty("catalina.base"), directory);
+            dir = new File(System.getProperty(Globals.CATALINA_BASE_PROP), directory);
         dir.mkdirs();
 
         // Open the current log file

Modified: tomcat/trunk/java/org/apache/jasper/compiler/AntCompiler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/AntCompiler.java?rev=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/AntCompiler.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/AntCompiler.java Thu Sep  2 14:52:11 2010
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.io.PrintStream;
 import java.util.StringTokenizer;
 
+import org.apache.catalina.Globals;
 import org.apache.jasper.JasperException;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -74,8 +75,8 @@ public class AntCompiler extends Compile
         logger.setErrorPrintStream(System.err);
         logger.setMessageOutputLevel(Project.MSG_INFO);
         project.addBuildListener( logger);
-        if (System.getProperty("catalina.home") != null) {
-            project.setBasedir( System.getProperty("catalina.home"));
+        if (System.getProperty(Globals.CATALINA_HOME_PROP) != null) {
+            project.setBasedir(System.getProperty(Globals.CATALINA_HOME_PROP));
         }
         
         if( options.getCompiler() != null ) {

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java?rev=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java Thu Sep  2 14:52:11
2010
@@ -25,6 +25,7 @@ import java.util.concurrent.TimeUnit;
 
 import javax.net.ssl.KeyManagerFactory;
 
+import org.apache.catalina.Globals;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.IntrospectionUtils;
@@ -466,7 +467,7 @@ public abstract class AbstractEndpoint {
     private String keystoreFile = System.getProperty("user.home")+"/.keystore";
     public String getKeystoreFile() { return keystoreFile;}
     public void setKeystoreFile(String s ) { 
-        String file = adjustRelativePath(s,System.getProperty("catalina.base"));
+        String file = adjustRelativePath(s, System.getProperty(Globals.CATALINA_BASE_PROP));
         this.keystoreFile = file; 
     }
 
@@ -513,7 +514,7 @@ public abstract class AbstractEndpoint {
     private String truststoreFile = System.getProperty("javax.net.ssl.trustStore");
     public String getTruststoreFile() {return truststoreFile;}
     public void setTruststoreFile(String s) {
-        String file = adjustRelativePath(s,System.getProperty("catalina.base"));
+        String file = adjustRelativePath(s, System.getProperty(Globals.CATALINA_BASE_PROP));
         this.truststoreFile = file;
     }
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java?rev=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java Thu Sep  2 14:52:11
2010
@@ -58,6 +58,7 @@ import javax.net.ssl.TrustManager;
 import javax.net.ssl.TrustManagerFactory;
 import javax.net.ssl.X509KeyManager;
 
+import org.apache.catalina.Globals;
 import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.res.StringManager;
 
@@ -377,7 +378,7 @@ public class JSSESocketFactory
                     "".equalsIgnoreCase(path))) {
                 File keyStoreFile = new File(path);
                 if (!keyStoreFile.isAbsolute()) {
-                    keyStoreFile = new File(System.getProperty("catalina.base"),
+                    keyStoreFile = new File(System.getProperty(Globals.CATALINA_BASE_PROP),
                                             path);
                 }
                 istream = new FileInputStream(keyStoreFile);
@@ -636,7 +637,7 @@ public class JSSESocketFactory
 
         File crlFile = new File(crlf);
         if( !crlFile.isAbsolute() ) {
-            crlFile = new File(System.getProperty("catalina.base"), crlf);
+            crlFile = new File(System.getProperty(Globals.CATALINA_BASE_PROP), crlf);
         }
         Collection<? extends CRL> crls = null;
         InputStream is = null;

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=991959&r1=991958&r2=991959&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu Sep  2 14:52:11 2010
@@ -102,6 +102,10 @@
         is being destroyed, the destroy method is only called once on each
         child component. (markt) 
       </update>
+      <update>
+        <bug>48967</bug>: Replace strings "catalina.base" and "catalina.home"
+        by globally defined constants. Patch provided by Marc Guillemot. (rjung)
+      </update>
     </changelog>
   </subsection>
   <subsection name="Coyote">



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


Mime
View raw message