Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 3746 invoked from network); 26 Jan 2003 06:17:14 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 26 Jan 2003 06:17:14 -0000 Received: (qmail 1269 invoked by uid 97); 26 Jan 2003 06:18:47 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 1259 invoked by uid 97); 26 Jan 2003 06:18:47 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 16890 invoked by uid 97); 25 Jan 2003 18:25:47 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Date: 25 Jan 2003 18:24:13 -0000 Message-ID: <20030125182413.47090.qmail@icarus.apache.org> From: olegk@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient HttpMethodBase.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N olegk 2003/01/25 10:24:13 Modified: httpclient/src/java/org/apache/commons/httpclient HttpMethodBase.java Log: Makes code in getResponseAsString() a bit more defensive Revision Changes Path 1.98 +18 -13 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java Index: HttpMethodBase.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v retrieving revision 1.97 retrieving revision 1.98 diff -u -r1.97 -r1.98 --- HttpMethodBase.java 25 Jan 2003 03:28:29 -0000 1.97 +++ HttpMethodBase.java 25 Jan 2003 18:24:13 -0000 1.98 @@ -155,13 +155,13 @@ * @author dIon Gillard * @author Jeff Dever * @author Davanum Srinivas - * @author Ortwin Gl�ck + * @author Ortwin Gl�ck * @author Eric Johnson * @author Michael Becke * @author Oleg Kalnichevski */ public abstract class HttpMethodBase implements HttpMethod { - //~ Static variables/initializers ������������������������������������������ + //~ Static variables/initializers ������������������������������������������ /** Maximum number of redirects and authentications that will be followed */ private static int maxForwards = 100; @@ -183,7 +183,7 @@ USER_AGENT = new Header("User-Agent", agent); } - //~ Instance variables ����������������������������������������������������� + //~ Instance variables ����������������������������������������������������� /** My request headers, if any. */ private Map requestHeaders = new HashMap(); @@ -252,7 +252,7 @@ private boolean doneWithConnection = false; - //~ Constructors ����������������������������������������������������������� + //~ Constructors ����������������������������������������������������������� // ----------------------------------------------------------- Constructors @@ -306,7 +306,7 @@ } } - //~ Methods ���������������������������������������������������������������� + //~ Methods ���������������������������������������������������������������� // ------------------------------------------- Property Setters and Getters @@ -681,11 +681,16 @@ */ public String getResponseBodyAsString() { - if (!responseAvailable()) - { - return null; + byte[] rawdata = null; + if (responseAvailable()) { + rawdata = getResponseBody(); } - return HttpConstants.getContentString(getResponseBody(), getResponseCharSet()); + if (rawdata != null) { + return HttpConstants.getContentString(rawdata, getResponseCharSet()); + } + else { + return null; + } } -- To unsubscribe, e-mail: For additional commands, e-mail: