mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Read HTTP error stream before closing it
It wasn't causing problems, but it looks odd.
This commit is contained in:
parent
51059fe6a9
commit
e6197938fe
1 changed files with 4 additions and 3 deletions
|
@ -22,14 +22,15 @@ public class HttpClient {
|
|||
URL url = new URL(baseUrl + param);
|
||||
connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
connection.setConnectTimeout(10000);
|
||||
connection.setReadTimeout(10000);
|
||||
connection.setConnectTimeout(10_000);
|
||||
connection.setReadTimeout(10_000);
|
||||
|
||||
if (connection.getResponseCode() == 200) {
|
||||
return convertInputStreamToString(connection.getInputStream());
|
||||
} else {
|
||||
String error = convertInputStreamToString(connection.getErrorStream());
|
||||
connection.getErrorStream().close();
|
||||
throw new HttpException(convertInputStreamToString(connection.getErrorStream()));
|
||||
throw new HttpException(error);
|
||||
}
|
||||
} finally {
|
||||
if (connection != null)
|
||||
|
|
Loading…
Add table
Reference in a new issue