mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-19 23:36:00 -04: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
@ -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…
x
Reference in New Issue
Block a user