You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2026/10/08 15:43:09 UTC

(tomcat) 20/24: Correct the Tomcat.init() Javadoc regarding the configuration source.

This is an automated email from the ASF dual-hosted git repository.

rmaucher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 98caef009174e2e69893b12899fc18070043066f
Author: opencode <re...@apache.org>
AuthorDate: Thu Oct 8 17:03:00 2026 +0200

    Correct the Tomcat.init() Javadoc regarding the configuration source.
    
    The Javadoc implied that calling init() with no configuration source would
    always use the default configuration locations. In fact the configuration
    source is a JVM-global value managed by ConfigFileLoader.setSource(), which is
    deliberately "only the first call has an effect": once a source has been
    configured, by an earlier Tomcat instance or any other caller in the same JVM,
    it is used for all subsequent configuration and can be neither replaced by a
    different source nor reset to the defaults by passing null.
    
    No behaviour change. This only documents the existing, intentional semantics so
    that the default locations are correctly described as applying only when no
    source has been configured previously in the JVM.
---
 java/org/apache/catalina/startup/Tomcat.java | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/catalina/startup/Tomcat.java b/java/org/apache/catalina/startup/Tomcat.java
index af44e397b6..e071b4a749 100644
--- a/java/org/apache/catalina/startup/Tomcat.java
+++ b/java/org/apache/catalina/startup/Tomcat.java
@@ -408,8 +408,11 @@ public class Tomcat {
 
     /**
      * Initialize the server given the specified configuration source. The server will be loaded according to the Tomcat
-     * configuration files contained in the source (server.xml, web.xml, context.xml, SSL certificates, etc). If no
-     * configuration source is specified, it will use the default locations for these files.
+     * configuration files contained in the source (server.xml, web.xml, context.xml, SSL certificates, etc). The
+     * configuration source is global to the JVM. Once a source has been configured, by this instance or by any earlier
+     * use in the same JVM, it will be used for all subsequent configuration and cannot be replaced: neither a later
+     * call specifying a different source nor a call specifying no source has any effect. If no source is specified and
+     * none has been configured previously, the default locations for these files are used.
      *
      * @param source The configuration source
      */
@@ -419,8 +422,11 @@ public class Tomcat {
 
     /**
      * Initialize the server given the specified configuration source. The server will be loaded according to the Tomcat
-     * configuration files contained in the source (server.xml, web.xml, context.xml, SSL certificates, etc). If no
-     * configuration source is specified, it will use the default locations for these files.
+     * configuration files contained in the source (server.xml, web.xml, context.xml, SSL certificates, etc). The
+     * configuration source is global to the JVM. Once a source has been configured, by this instance or by any earlier
+     * use in the same JVM, it will be used for all subsequent configuration and cannot be replaced: neither a later
+     * call specifying a different source nor a call specifying no source has any effect. If no source is specified and
+     * none has been configured previously, the default locations for these files are used.
      *
      * @param source            The configuration source
      * @param catalinaArguments The arguments that should be passed to Catalina


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