ofbiz-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas Malin (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (OFBIZ-10281) HttpClient failed to return the error result
Date Mon, 19 Mar 2018 16:08:00 GMT

     [ https://issues.apache.org/jira/browse/OFBIZ-10281?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Nicolas Malin closed OFBIZ-10281.
---------------------------------
       Resolution: Fixed
    Fix Version/s: Upcoming Branch

done on trunk at revision 1827212

> HttpClient failed to return the error result
> --------------------------------------------
>
>                 Key: OFBIZ-10281
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10281
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Trunk
>            Reporter: Nicolas Malin
>            Assignee: Nicolas Malin
>            Priority: Minor
>             Fix For: Upcoming Branch
>
>         Attachments: OFBIZ-10281.patch
>
>
> When you call the HttpClient on Rest API on url that return you an error, the HttpClient
failed to give you the error stream:
> {code:java}
> callResult = restClient.getStream();{code}
> If the flow is an error you have HttpClient:534
> {code:java}
> in = con.getInputStream();
> {code}
> return a FileNotFoundException
> To solve this I catch the error and restart the connexion like this
> {code:java}
> if ((con instanceof HttpURLConnection)) {
>     try {
>         in = ((HttpURLConnection) con).getErrorStream();
>     } catch (Exception ioerror) {
>         throw new HttpClientException("IO Error processing request", ioerror);
>     }
>     return in;
> }{code}
> With this the inputStream contains the error message and we can use it for end user return



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message