Author: markt
Date: Thu Jun  1 19:44:14 2017
New Revision: 1797255

URL: http://svn.apache.org/viewvc?rev=1797255&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=48543
Add the option to specify an alternative file name for the catalina.config 
system property. Also document that relative, as well as absolute, URLs are 
permitted.

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/CatalinaProperties.java
    tomcat/trunk/webapps/docs/changelog.xml
    tomcat/trunk/webapps/docs/config/systemprops.xml

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=1797255&r1=1797254&r2=1797255&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/CatalinaProperties.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/startup/CatalinaProperties.java Thu 
Jun  1 19:44:14 2017
@@ -60,10 +60,17 @@ public class CatalinaProperties {
     private static void loadProperties() {
 
         InputStream is = null;
+        String fileName = "catalina.properties";
+
         try {
             String configUrl = System.getProperty("catalina.config");
             if (configUrl != null) {
-                is = (new URL(configUrl)).openStream();
+                if (configUrl.indexOf('/') == -1) {
+                    // No '/'. Must be a file name rather than a URL
+                    fileName = configUrl;
+                } else {
+                    is = (new URL(configUrl)).openStream();
+                }
             }
         } catch (Throwable t) {
             handleThrowable(t);
@@ -73,7 +80,7 @@ public class CatalinaProperties {
             try {
                 File home = new File(Bootstrap.getCatalinaBase());
                 File conf = new File(home, "conf");
-                File propsFile = new File(conf, "catalina.properties");
+                File propsFile = new File(conf, fileName);
                 is = new FileInputStream(propsFile);
             } catch (Throwable t) {
                 handleThrowable(t);
@@ -100,14 +107,14 @@ public class CatalinaProperties {
                 try {
                     is.close();
                 } catch (IOException ioe) {
-                    log.warn("Could not close catalina.properties", ioe);
+                    log.warn("Could not close catalina properties file", ioe);
                 }
             }
         }
 
         if ((is == null)) {
             // Do something
-            log.warn("Failed to load catalina.properties");
+            log.warn("Failed to load catalina properties file");
             // That's fine - we have reasonable defaults.
             properties = new Properties();
         }

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1797255&r1=1797254&r2=1797255&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu Jun  1 19:44:14 2017
@@ -48,6 +48,11 @@
   <subsection name="Catalina">
     <changelog>
       <fix>
+        <bug>48543</bug>: Add the option to specify an alternative file name 
for
+        the <code>catalina.config</code> system property. Also document that
+        relative, as well as absolute, URLs are permitted. (markt)
+      </fix>
+      <fix>
         <bug>61072</bug>: Respect the documentation statements that allow
         using the platform default secure random for session id generation.
         (remm)

Modified: tomcat/trunk/webapps/docs/config/systemprops.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/systemprops.xml?rev=1797255&r1=1797254&r2=1797255&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/systemprops.xml (original)
+++ tomcat/trunk/webapps/docs/config/systemprops.xml Thu Jun  1 19:44:14 2017
@@ -580,7 +580,11 @@
     </property>
 
     <property name="catalina.config">
-      <p>The URL for the catalina.properties configuration file.</p>
+      <p>The location from which to load the catalina.properties configuration
+      file. This may be an absolute URL, a relative (to the current working
+      directory) URL or an alternative file name in which case Tomcat will
+      attempt to load the file from the default location of
+      <code>$CATALINA_BASE/conf/</code>.</p>
     </property>
 
     <property name="tomcat.util.buf.StringCache.byte.enabled">



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

Reply via email to