From d8e2dbc222b4ec78d81a19f4e31640279502db8b Mon Sep 17 00:00:00 2001 From: markt Date: Mon, 6 Dec 2010 21:25:07 +0000 Subject: [PATCH] Include root cause in LifecycleException stack traces git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1042798 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/LifecycleException.java | 82 ++-------------------- java/org/apache/catalina/connector/Connector.java | 8 +-- .../catalina/connector/LocalStrings.properties | 8 +-- 3 files changed, 13 insertions(+), 85 deletions(-) diff --git a/java/org/apache/catalina/LifecycleException.java b/java/org/apache/catalina/LifecycleException.java index ee94ef171..54aa3f083 100644 --- a/java/org/apache/catalina/LifecycleException.java +++ b/java/org/apache/catalina/LifecycleException.java @@ -39,9 +39,7 @@ public final class LifecycleException extends Exception { * Construct a new LifecycleException with no other information. */ public LifecycleException() { - - this(null, null); - + super(); } @@ -51,9 +49,7 @@ public final class LifecycleException extends Exception { * @param message Message describing this exception */ public LifecycleException(String message) { - - this(message, null); - + super(message); } @@ -63,9 +59,7 @@ public final class LifecycleException extends Exception { * @param throwable Throwable that caused this exception */ public LifecycleException(Throwable throwable) { - - this(null, throwable); - + super(throwable); } @@ -77,72 +71,6 @@ public final class LifecycleException extends Exception { * @param throwable Throwable that caused this exception */ public LifecycleException(String message, Throwable throwable) { - - super(); - this.message = message; - this.throwable = throwable; - + super(message, throwable); } - - - //------------------------------------------------------ Instance Variables - - - /** - * The error message passed to our constructor (if any) - */ - protected String message = null; - - - /** - * The underlying exception or error passed to our constructor (if any) - */ - protected Throwable throwable = null; - - - //---------------------------------------------------------- Public Methods - - - /** - * Returns the message associated with this exception, if any. - */ - @Override - public String getMessage() { - - return (message); - - } - - - /** - * Returns the throwable that caused this exception, if any. - */ - public Throwable getThrowable() { - - return (throwable); - - } - - - /** - * Return a formatted string that describes this exception. - */ - @Override - public String toString() { - - StringBuilder sb = new StringBuilder("LifecycleException: "); - if (message != null) { - sb.append(message); - if (throwable != null) { - sb.append(": "); - } - } - if (throwable != null) { - sb.append(throwable.toString()); - } - return (sb.toString()); - - } - - -} +} \ No newline at end of file diff --git a/java/org/apache/catalina/connector/Connector.java b/java/org/apache/catalina/connector/Connector.java index 9ec57b817..b65250ec5 100644 --- a/java/org/apache/catalina/connector/Connector.java +++ b/java/org/apache/catalina/connector/Connector.java @@ -904,7 +904,7 @@ public class Connector extends LifecycleMBeanBase { } catch (Exception e) { throw new LifecycleException (sm.getString - ("coyoteConnector.protocolHandlerInitializationFailed", e)); + ("coyoteConnector.protocolHandlerInitializationFailed"), e); } onameProtocolHandler = register(protocolHandler, @@ -935,7 +935,7 @@ public class Connector extends LifecycleMBeanBase { throw new LifecycleException (errPrefix + " " + sm.getString - ("coyoteConnector.protocolHandlerStartFailed", e)); + ("coyoteConnector.protocolHandlerStartFailed"), e); } mapperListener.start(); @@ -957,7 +957,7 @@ public class Connector extends LifecycleMBeanBase { } catch (Exception e) { throw new LifecycleException (sm.getString - ("coyoteConnector.protocolHandlerStopFailed", e)); + ("coyoteConnector.protocolHandlerStopFailed"), e); } mapperListener.stop(); @@ -974,7 +974,7 @@ public class Connector extends LifecycleMBeanBase { } catch (Exception e) { throw new LifecycleException (sm.getString - ("coyoteConnector.protocolHandlerDestroyFailed", e)); + ("coyoteConnector.protocolHandlerDestroyFailed"), e); } if (getService() != null) { diff --git a/java/org/apache/catalina/connector/LocalStrings.properties b/java/org/apache/catalina/connector/LocalStrings.properties index 02d5efbd1..70131a393 100644 --- a/java/org/apache/catalina/connector/LocalStrings.properties +++ b/java/org/apache/catalina/connector/LocalStrings.properties @@ -18,10 +18,10 @@ # CoyoteConnector # coyoteConnector.cannotRegisterProtocol=Cannot register MBean for the Protocol -coyoteConnector.protocolHandlerDestroyFailed=Protocol handler destroy failed: {0} -coyoteConnector.protocolHandlerInitializationFailed=Protocol handler initialization failed: {0} -coyoteConnector.protocolHandlerInstantiationFailed=Protocol handler instantiation failed: {0} -coyoteConnector.protocolHandlerStartFailed=Protocol handler start failed: {0} +coyoteConnector.protocolHandlerDestroyFailed=Protocol handler destroy failed +coyoteConnector.protocolHandlerInitializationFailed=Protocol handler initialization failed +coyoteConnector.protocolHandlerInstantiationFailed=Protocol handler instantiation failed +coyoteConnector.protocolHandlerStartFailed=Protocol handler start failed coyoteConnector.protocolRegistrationFailed=Protocol JMX registration failed coyoteConnector.protocolHandlerPauseFailed=Protocol handler pause failed coyoteConnector.protocolHandlerResumeFailed=Protocol handler resume failed -- 2.11.0