Index: src/java/org/apache/commons/httpclient/HttpException.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpException.java,v retrieving revision 1.13 diff -u -r1.13 HttpException.java --- src/java/org/apache/commons/httpclient/HttpException.java 28 Jan 2003 04:40:20 -0000 1.13 +++ src/java/org/apache/commons/httpclient/HttpException.java 12 May 2003 22:39:24 -0000 @@ -83,6 +83,7 @@ * * * @author Unascribed + * @author Adrian Sutton * @version $Revision: 1.13 $ $Date: 2003/01/28 04:40:20 $ */ public class HttpException extends URIException { @@ -101,5 +102,26 @@ */ public HttpException(String message) { super(message); + } + + /** + * Creates a new HttpException with the specified cause. + * + * @param cause the original exception that caused this one to be + * thrown. + */ + public HttpException(Throwable cause) { + super(cause); + } + + /** + * Creates a new HttpException with the specified message and cause. + * + * @param message the exception message. + * @param cause the original exception that caused this one to be + * thrown. + */ + public HttpException(String message, Throwable cause) { + super(message, cause); } } Index: src/java/org/apache/commons/httpclient/HttpRecoverableException.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpRecoverableException.java,v retrieving revision 1.7 diff -u -r1.7 HttpRecoverableException.java --- src/java/org/apache/commons/httpclient/HttpRecoverableException.java 28 Jan 2003 22:25:21 -0000 1.7 +++ src/java/org/apache/commons/httpclient/HttpRecoverableException.java 12 May 2003 22:39:24 -0000 @@ -70,6 +70,7 @@ * may be retried. *
* @author Unascribed + * @author Adrian Sutton * @version $Revision: 1.7 $ $Date: 2003/01/28 22:25:21 $ */ public class HttpRecoverableException extends HttpException { @@ -89,5 +90,28 @@ */ public HttpRecoverableException(String message) { super(message); + } + + /** + * Creates a new HttpRecoverableException with the specificied + * cause. + * + * @param cause the original exception that caused this one to be + * thrown. + */ + public HttpRecoverableException(Throwable cause) { + super(cause); + } + + /** + * Creates a new HttpRecoverableException with the specified message + * and cause. + * + * @param message the exception message. + * @param cause the original exception that caused this one to be + * thrown. + */ + public HttpRecoverableException(String message, Throwable cause) { + super(message, cause); } } Index: src/java/org/apache/commons/httpclient/URIException.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URIException.java,v retrieving revision 1.8 diff -u -r1.8 URIException.java --- src/java/org/apache/commons/httpclient/URIException.java 31 Jan 2003 00:33:36 -0000 1.8 +++ src/java/org/apache/commons/httpclient/URIException.java 12 May 2003 22:39:24 -0000 @@ -73,6 +73,7 @@ ** * @author Sung-Gu + * @author Adrian Sutton * @version $Revision: 1.8 $ $Date: 2002/03/14 15:14:01 */ public class URIException extends IOException { @@ -120,6 +121,39 @@ setReasonCode(UNKNOWN); } + /** + * The constructor with a cause argument. + * + * @param cause the original exception that caused this exception. + */ + public URIException(Throwable cause) { + this(); // should this be this(cause.getMessage()); ? + this.cause = cause; + } + + /** + * The constructor with a reason string and throwable cause. + * + * @param reason the reason the exception was thrown. + * @param cause the original exception that caused this exception. + */ + public URIException(String reason, Throwable cause) { + this(reason); + this.cause = cause; + } + + /** + * The constructor with a reason code, string and throwable cause. + * + * @param reasonCode the reason code. + * @param reason the reason this exception was thrown. + * @param cause the original exception that caused this exception. + */ + public URIException(int reasonCode, String reason, Throwable cause) { + this(reasonCode, reason); + this.cause = cause; + } + // -------------------------------------------------------------- constants /** @@ -164,6 +198,11 @@ */ protected String reason; + /** + * The original exception that caused this one. + */ + private Throwable cause; + // ---------------------------------------------------------------- methods /** @@ -205,6 +244,24 @@ this.reason = reason; } + /** + * Returns the original exception that caused this + * exception to be thrown. + * + * @return the Throwable that caused this exception. + */ + public Throwable getCause() { + return cause; + } + + /** + * Sets the cause of this exception. + * + * @param cause the original exception that caused this one. + */ + public void setCause(Throwable cause) { + this.cause = cause; + } }