This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push: new 62efcf7 Add a new flag in Catalina for errors on init 62efcf7 is described below commit 62efcf70ecf0a96f5f12a3f3ebfefc146a9ec336 Author: remm <r...@apache.org> AuthorDate: Thu Apr 2 13:28:47 2020 +0200 Add a new flag in Catalina for errors on init Use the system property as the default value, same as Connector. I experimented having it extend LifecycleBase, but it wasn't that successful. --- java/org/apache/catalina/startup/Catalina.java | 27 +++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/startup/Catalina.java b/java/org/apache/catalina/startup/Catalina.java index f5a0974..362d0d0 100644 --- a/java/org/apache/catalina/startup/Catalina.java +++ b/java/org/apache/catalina/startup/Catalina.java @@ -132,6 +132,13 @@ public class Catalina { protected boolean loaded = false; + /** + * Rethrow exceptions on init failure. + */ + protected boolean throwOnInitFailure = + Boolean.getBoolean("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE"); + + // ----------------------------------------------------------- Constructors public Catalina() { @@ -163,6 +170,24 @@ public class Catalina { /** + * @return <code>true</code> if an exception should be thrown if an error + * occurs during server init + */ + public boolean getThrowOnInitFailure() { + return throwOnInitFailure; + } + + + /** + * Set the behavior regarding errors that could occur during server init. + * @param throwOnInitFailure the new flag value + */ + public void setThrowOnInitFailure(boolean throwOnInitFailure) { + this.throwOnInitFailure = throwOnInitFailure; + } + + + /** * Set the shared extensions class loader. * * @param parentClassLoader The shared extensions class loader. @@ -583,7 +608,7 @@ public class Catalina { try { getServer().init(); } catch (LifecycleException e) { - if (Boolean.getBoolean("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE")) { + if (throwOnInitFailure) { throw new java.lang.Error(e); } else { log.error(sm.getString("catalina.initError"), e); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org