mirror of https://github.com/M66B/FairEmail.git
Make sure URL connection is closed
This commit is contained in:
parent
64e48fdc76
commit
b8e04341ab
|
@ -354,7 +354,7 @@ public class ContactInfo {
|
|||
emailGravatar.put(gkey, new Gravatar(false));
|
||||
}
|
||||
} else
|
||||
throw new IOException("HTTP status=" + status);
|
||||
throw new IOException("Error " + status + ": " + urlConnection.getResponseMessage());
|
||||
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
|
|
|
@ -639,6 +639,7 @@ class ImageHelper {
|
|||
urlConnection.setRequestProperty("User-Agent", WebViewEx.getUserAgent(context));
|
||||
urlConnection.connect();
|
||||
|
||||
try {
|
||||
int status = urlConnection.getResponseCode();
|
||||
|
||||
if (status == HttpURLConnection.HTTP_MOVED_PERM ||
|
||||
|
@ -662,7 +663,11 @@ class ImageHelper {
|
|||
}
|
||||
|
||||
if (status != HttpURLConnection.HTTP_OK)
|
||||
throw new IOException("HTTP status=" + status);
|
||||
throw new IOException("Error " + status + ": " + urlConnection.getResponseMessage());
|
||||
} catch (IOException ex) {
|
||||
urlConnection.disconnect();
|
||||
throw ex;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue