Index: src/java/org/apache/commons/httpclient/HttpMethodBase.java =================================================================== --- src/java/org/apache/commons/httpclient/HttpMethodBase.java (revision 230416) +++ src/java/org/apache/commons/httpclient/HttpMethodBase.java (working copy) @@ -1071,19 +1071,15 @@ * @since 2.0 */ public void releaseConnection() { - - if (responseStream != null) { - try { - // FYI - this may indirectly invoke responseBodyConsumed. - responseStream.close(); - } catch (IOException e) { - // the connection may not have been released, let's make sure - ensureConnectionRelease(); + try { + if (this.responseStream != null) { + try { + // FYI - this may indirectly invoke responseBodyConsumed. + this.responseStream.close(); + } catch (IOException ignore) { + } } - } else { - // Make sure the connection has been released. If the response - // stream has not been set, this is the only way to release the - // connection. + } finally { ensureConnectionRelease(); } } @@ -2261,7 +2257,7 @@ responseConnection.close(); } else { try { - if(responseConnection.isResponseAvailable()) { + if(responseConnection.isOpen() && responseConnection.isResponseAvailable()) { boolean logExtraInput = getParams().isParameterTrue(HttpMethodParams.WARN_EXTRA_INPUT);