Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: Trunk
-
Fix Version/s: Upcoming Branch
-
Component/s: framework
-
Labels:None
Description
When you call the HttpClient on Rest API on url that return you an error, the HttpClient failed to give you the error stream:
callResult = restClient.getStream();
If the flow is an error you have HttpClient:534
in = con.getInputStream();
return a FileNotFoundException
To solve this I catch the error and restart the connexion like this
if ((con instanceof HttpURLConnection)) { try { in = ((HttpURLConnection) con).getErrorStream(); } catch (Exception ioerror) { throw new HttpClientException("IO Error processing request", ioerror); } return in; }
With this the inputStream contains the error message and we can use it for end user return