Author: kkolinko Date: Sun Oct 26 12:13:16 2014 New Revision: 1634311 URL: http://svn.apache.org/r1634311 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57144 Improve ClientAbortException to provide non-null message in getMessage() and full class name in toString().
Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/ClientAbortException.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/ClientAbortException.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/ClientAbortException.java?rev=1634311&r1=1634310&r2=1634311&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/ClientAbortException.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/ClientAbortException.java Sun Oct 26 12:13:16 2014 @@ -24,7 +24,6 @@ import java.io.IOException; * * @author Glenn L. Nielsen */ - public final class ClientAbortException extends IOException { private static final long serialVersionUID = 1L; @@ -36,9 +35,7 @@ public final class ClientAbortException * Construct a new ClientAbortException with no other information. */ public ClientAbortException() { - - this(null, null); - + super(); } @@ -48,9 +45,8 @@ public final class ClientAbortException * @param message Message describing this exception */ public ClientAbortException(String message) { - - this(message, null); - + super(message); + this.message = getMessage(); } @@ -60,9 +56,9 @@ public final class ClientAbortException * @param throwable Throwable that caused this exception */ public ClientAbortException(Throwable throwable) { - - this(null, throwable); - + super(throwable); + this.message = getMessage(); + this.throwable = throwable; } @@ -74,11 +70,9 @@ public final class ClientAbortException * @param throwable Throwable that caused this exception */ public ClientAbortException(String message, Throwable throwable) { - - super(); - this.message = message; + super(message, throwable); + this.message = getMessage(); this.throwable = throwable; - } @@ -87,60 +81,17 @@ public final class ClientAbortException /** * The error message passed to our constructor (if any) + * @deprecated Use {@link Throwable#getMessage()} */ + @Deprecated protected String message = null; /** * The underlying exception or error passed to our constructor (if any) + * @deprecated Use {@link Throwable#getCause()} */ + @Deprecated protected Throwable throwable = null; - - //---------------------------------------------------------- Public Methods - - - /** - * Returns the message associated with this exception, if any. - */ - @Override - public String getMessage() { - - return (message); - - } - - - /** - * Returns the cause that caused this exception, if any. - */ - @Override - public Throwable getCause() { - - return (throwable); - - } - - - /** - * Return a formatted string that describes this exception. - */ - @Override - public String toString() { - - StringBuilder sb = new StringBuilder("ClientAbortException: "); - if (message != null) { - sb.append(message); - if (throwable != null) { - sb.append(": "); - } - } - if (throwable != null) { - sb.append(throwable.toString()); - } - return (sb.toString()); - - } - - } Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1634311&r1=1634310&r2=1634311&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Sun Oct 26 12:13:16 2014 @@ -97,6 +97,10 @@ Update the minimum required version of the Tomcat Native library (if used) to 1.1.32. (markt) </update> + <update> + <bug>57144</bug>: Improve ClientAbortException to provide non-null + message. (kkolinko) + </update> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org