Index: java/org/apache/commons/httpclient/HttpMethodBase.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v retrieving revision 1.152 diff -u -r1.152 HttpMethodBase.java --- java/org/apache/commons/httpclient/HttpMethodBase.java 13 Jun 2003 21:32:17 -0000 1.152 +++ java/org/apache/commons/httpclient/HttpMethodBase.java 20 Jun 2003 12:22:49 -0000 @@ -1,5 +1,5 @@ /* - * $Header: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v 1.152 2003/06/13 21:32:17 olegk Exp $ + * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v 1.152 2003/06/13 21:32:17 olegk Exp $ * $Revision: 1.152 $ * $Date: 2003/06/13 21:32:17 $ * @@ -676,34 +676,11 @@ } for (int i = headers.length - 1; i >= 0; i++) { Header header = headers[i]; - String lengthValue = null; - // we're using this just in case the content length is duplicated - // i.e. '57, 57' try { - HeaderElement[] lengthElements = header.getValues(); - - if (lengthElements.length > 1) { - // looks like the content length header was duplicated. if so - // they won't be key=value pairs so we just want to get - // the name not the value (which should be null) - // take the first value and ignore any others - lengthValue = lengthElements[0].getName(); - } else { - lengthValue = header.getValue(); - } - } catch (HttpException e) { + return Integer.parseInt(header.getValue()); + } catch (NumberFormatException e) { if (LOG.isWarnEnabled()) { LOG.warn("Invalid content-length value: " + e.getMessage()); - } - lengthValue = null; - } - if (lengthValue != null) { - try { - return Integer.parseInt(lengthValue); - } catch (NumberFormatException e) { - if (LOG.isWarnEnabled()) { - LOG.warn("Invalid content-length value: " + e.getMessage()); - } } } // See if we can have better luck with another header, if present