[
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)