--- HttpConnection.java.orig 2004-12-20 12:35:18.756665528 +0100 +++ HttpConnection.java.A 2004-12-20 12:40:08.586604680 +0100 @@ -1162,17 +1162,34 @@ } /** - * Release the connection. + * Releases the connection. In certain cases the connection cannot be + * released: + * + *
In either of these cases, an {@link IllegalStateException} is + * thrown. + * + * @throws IllegalStateException + * if the connection cannot be released in the current state. */ - public void releaseConnection() { + public void releaseConnection() throws IllegalStateException { LOG.trace("enter HttpConnection.releaseConnection()"); if (locked) { - LOG.debug("Connection is locked. Call to releaseConnection() ignored."); + String message = "Connection is locked. Call to releaseConnection() ignored."; + LOG.debug(message); + throw new IllegalStateException(message); } else if (httpConnectionManager != null) { LOG.debug("Releasing connection back to connection manager."); httpConnectionManager.releaseConnection(this); } else { - LOG.warn("HttpConnectionManager is null. Connection cannot be released."); + String message = "HttpConnectionManager is null. Connection cannot be released."; + LOG.debug(message); + throw new IllegalStateException(message); } }