You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by og...@apache.org on 2003/02/24 20:12:06 UTC
cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient HttpClient.java
oglueck 2003/02/24 11:12:06
Modified: httpclient/src/java/org/apache/commons/httpclient
HttpClient.java
Log:
clean up catch clause
Revision Changes Path
1.70 +9 -14 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java
Index: HttpClient.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- HttpClient.java 21 Feb 2003 13:48:09 -0000 1.69
+++ HttpClient.java 24 Feb 2003 19:12:06 -0000 1.70
@@ -552,11 +552,6 @@
);
try {
- // Catch all possible exceptions to make sure to release the
- // connection, as although the user may call
- // Method->releaseConnection(), the method doesn't know about the
- // connection until HttpMethod.execute() is called.
-
method.setStrictMode(strictMode);
if (!connection.isOpen()) {
@@ -567,12 +562,12 @@
method = new ConnectMethod(method);
}
}
- } catch (IOException e) {
- connection.releaseConnection();
- throw e;
- } catch (RuntimeException e) {
+ } finally {
+ // make sure to release the
+ // connection, as although the user may call
+ // Method->releaseConnection(), the method doesn't know about the
+ // connection until HttpMethod.execute() is called.
connection.releaseConnection();
- throw e;
}
return method.execute(state, connection);
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient
HttpClient.java
Posted by Ortwin Glück <or...@nose.ch>.
Oh dear! What have I done... shame on me.
I'll fix that immediately. Sorry for that.
Michael Becke wrote:
> I don't think this is what we want. This patch causes all connections
> to be released before execution. The intent was to only release the
> connection when an exception occurred and method.execute() could not be
> called.
>
> Mike
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient
HttpClient.java
Posted by Michael Becke <be...@u.washington.edu>.
I don't think this is what we want. This patch causes all connections
to be released before execution. The intent was to only release the
connection when an exception occurred and method.execute() could not be
called.
Mike
oglueck@apache.org wrote:
> oglueck 2003/02/24 11:12:06
>
> Modified: httpclient/src/java/org/apache/commons/httpclient
> HttpClient.java
> Log:
> clean up catch clause
>
> Revision Changes Path
> 1.70 +9 -14 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java
>
> Index: HttpClient.java
> ===================================================================
> RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpClient.java,v
> retrieving revision 1.69
> retrieving revision 1.70
> diff -u -r1.69 -r1.70
> --- HttpClient.java 21 Feb 2003 13:48:09 -0000 1.69
> +++ HttpClient.java 24 Feb 2003 19:12:06 -0000 1.70
> @@ -552,11 +552,6 @@
> );
>
> try {
> - // Catch all possible exceptions to make sure to release the
> - // connection, as although the user may call
> - // Method->releaseConnection(), the method doesn't know about the
> - // connection until HttpMethod.execute() is called.
> -
> method.setStrictMode(strictMode);
>
> if (!connection.isOpen()) {
> @@ -567,12 +562,12 @@
> method = new ConnectMethod(method);
> }
> }
> - } catch (IOException e) {
> - connection.releaseConnection();
> - throw e;
> - } catch (RuntimeException e) {
> + } finally {
> + // make sure to release the
> + // connection, as although the user may call
> + // Method->releaseConnection(), the method doesn't know about the
> + // connection until HttpMethod.execute() is called.
> connection.releaseConnection();
> - throw e;
> }
>
> return method.execute(state, connection);
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org