olegk 2004/09/30 11:53:20 Modified: httpclient/src/java/org/apache/commons/httpclient HttpException.java URIException.java Log: PR #31476 (3.0 not compile-time compatible with 2.0 library usage) Restores compatibility with 2.0 clients Contributed by Eric Johnson <eric at tibco.com> Reviewed by Oleg Kalnichevski Revision Changes Path 1.19 +69 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpException.java Index: HttpException.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpException.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- HttpException.java 13 May 2004 04:03:24 -0000 1.18 +++ HttpException.java 30 Sep 2004 18:53:20 -0000 1.19 @@ -164,6 +164,71 @@ } } + /** + * Sets the text description of the reason for an exception. + * + * @param reason The reason for the exception. + * + * @deprecated HttpClient no longer uses this for itself. It is only + * provided for compatibility with existing clients, and will be removed + * in a future release. + */ + public void setReason(String reason) { + this.reason = reason; + } + + /** + * Get the text description of the reason for an exception. + * + * @deprecated HttpClient no longer uses this for itself. It is only + * provided for compatibility with existing clients, and will be removed + * in a future release. + */ + public String getReason() { + return reason; + } + + /** + * Sets the status code description of the reason for an exception. + * + * @param code The reason for the exception. This is intended to be an + * HTTP status code. + * + * @deprecated HttpClient no longer uses this for itself. It is only + * provided for compatibility with existing clients, and will be removed + * in a future release. + */ + public void setReasonCode(int code) { + reasonCode = code; + } + + /** + * Get the status code description of the reason for an exception. + * + * @deprecated HttpClient no longer uses this for itself. It is only + * provided for compatibility with existing clients, and will be removed + * in a future release. + */ + public int getReasonCode() { + return this.reasonCode; + } + + /** + * A "reason" string provided for compatibility with older clients. + * + * @deprecated HttpClient no longer uses this field for itself. It + * is only provided for compatibility with existing clients. + */ + private String reason; + + /** + * Reason code for compatibility with older clients. + * + * @deprecated HttpClient no longer uses this field for itself. + * It is only provided for compatibility with existing clients. + */ + private int reasonCode = HttpStatus.SC_OK; + /** The original Throwable representing the cause of this error */ private final Throwable cause; } 1.12 +14 -8 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URIException.java Index: URIException.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URIException.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- URIException.java 18 Apr 2004 23:51:35 -0000 1.11 +++ URIException.java 30 Sep 2004 18:53:20 -0000 1.12 @@ -53,7 +53,7 @@ * @param reasonCode the reason code */ public URIException(int reasonCode) { - setReasonCode(reasonCode); + this.reasonCode = reasonCode; } @@ -66,7 +66,7 @@ public URIException(int reasonCode, String reason) { super(reason); // for backward compatibility of Throwable this.reason = reason; - setReasonCode(reasonCode); + this.reasonCode = reasonCode; } @@ -78,7 +78,7 @@ public URIException(String reason) { super(reason); // for backward compatibility of Throwable this.reason = reason; - setReasonCode(UNKNOWN); + this.reasonCode = UNKNOWN; } // -------------------------------------------------------------- constants @@ -136,11 +136,13 @@ return reasonCode; } - /** * Set the reason code. * * @param reasonCode the reason code + * + * @deprecated Callers should set the reason code as a parameter to the + * constructor. */ public void setReasonCode(int reasonCode) { this.reasonCode = reasonCode; @@ -151,6 +153,8 @@ * Get the reason message. * * @return the reason message + * + * @deprecated You should instead call [EMAIL PROTECTED] #getMessage()}. */ public String getReason() { return reason; @@ -161,6 +165,8 @@ * Set the reason message. * * @param reason the reason message + * + * @deprecated Callers should instead set this via a parameter to the constructor. */ public void setReason(String reason) { this.reason = reason;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]