You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Michael Osipov (JIRA)" <ji...@apache.org> on 2015/01/25 20:02:35 UTC

[jira] [Comment Edited] (HTTPCLIENT-1602) Tutorial claims that HttpException is unrecoverable but the implementation is recoverable

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

Michael Osipov edited comment on HTTPCLIENT-1602 at 1/25/15 7:02 PM:
---------------------------------------------------------------------

Exactly, that is the problem. The definitions for both exception types describe the recoverability. If you throw an {{HttpException}} you cannot even retry manually, it will still fail. Checked is plain wrong. I perfectly understand the automatic recoverability but there is a documentation deficit between the established semantics of Java exceptions and what HttpClient understands under recoverability.

Moreover, I highly doubt that HttpClient will replay my {{PUT}} request:

bq. HttpClient will automatically retry those methods that are assumed to be idempotent.

I would require to buffer the {HttpEntity}}.


was (Author: michael-o):
Exactly, that is the problem. The definitions for both exception types describe the recoverability. If you throw an {{HttpException}} you cannot even retry manually, it will still fail. Checked is plain wrong. I perfectly understand the automatic recoverability but there is a documentation deficit between the established semantics of Java exceptions and what HttpClient understands by recoverability.

Moreover, I highly doubt that HttpClient will replay my {{PUT}} request:

bq. HttpClient will automatically retry those methods that are assumed to be idempotent.

I would require to buffer the {HttpEntity}}.

> Tutorial claims that HttpException is unrecoverable but the implementation is recoverable
> -----------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1602
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1602
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Documentation, HttpClient
>    Affects Versions: 4.3.6, 4.4 Beta1
>            Reporter: Michael Osipov
>
> According to the [chapter 1.4|http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html#d5e271] of the tutorial the {{HttpException}} and every derived one is unrecoverable. If you open up the [Javadoc|http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/HttpException.html?is-external=true] for, you'll see that is extends {{java.lang.Exception}}. This is wrong, unrecoverable exceptions always extend from {{java.lang.RuntimeException}} to indicate its nature which is an unchecked exception.
> See [this|http://ted-gao.blogspot.de/2013/03/best-practices-in-java-exception.html], paragraph *Checked or Unckecked Exception*. It ultimately refers to Effective Java, Item 58: Use checked exceptions for recoverable conditions and runtime exceptions for programming errors and Item 59: Avoid unnecessary use of checked exceptions.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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