This is an automated email from the ASF dual-hosted git repository. rmaucher pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit ceaa14b9c245c80ef0d4c32aebc2dbf8522d7b49 Author: opencode <[email protected]> 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 8e2674a01e..55e0276d03 100644 --- a/java/org/apache/catalina/startup/Tomcat.java +++ b/java/org/apache/catalina/startup/Tomcat.java @@ -410,8 +410,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 */ @@ -421,8 +424,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: [email protected] For additional commands, e-mail: [email protected]
