hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stepan Koltsov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HTTPCLIENT-942) ClientConnectionRelease example is incorrect
Date Sat, 12 Jun 2010 22:17:13 GMT

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12878320#action_12878320
] 

Stepan Koltsov commented on HTTPCLIENT-942:
-------------------------------------------

Thank you.

Do I really have to call httpget.abort() in case of unknown RuntimeException? And why Error
(like OutOfMemoryError) is not caught then?

httpclient-3 allowed standard simple try { ... } finally { release something } pattern.

method = ...
try {
  httpclient.execute(method);
  // do whatever I want
} finally {
  method.releaseConnection();
}

It is sad, if it is not possible in httpclient-4 (ResponseHandler is not an option in some
cases).

> ClientConnectionRelease example is incorrect
> --------------------------------------------
>
>                 Key: HTTPCLIENT-942
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-942
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Examples
>            Reporter: Stepan Koltsov
>            Priority: Minor
>             Fix For: 4.1 Alpha3
>
>
> http://svn.apache.org/repos/asf/httpcomponents/httpclient/tags/4.0.1/httpclient/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java
> is incorrect: 
> 1. if error happens in BufferedReader constructor (OutOfMemoryError, StackOverflowError),
reader.close() is not called and connection is not released
> 2. if error happens in reader.readLine(), reader.close() is called, but httpget.abort()
is not.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message