diff options
author | steckbrief <steckbrief@chefmail.de> | 2016-04-20 21:32:03 +0200 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2016-04-20 21:32:03 +0200 |
commit | 70938a31a0e78203449d769fa5bda15ce73d1ed4 (patch) | |
tree | d789c0c44b26bdeeedde286ab3e09a67c3dd0e5b /src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java | |
parent | 58572ba858835437011d2f450bd90fb93455b5c9 (diff) | |
parent | 7df96caedbbb96a28d4f7e07fa2d159c8ca1373f (diff) |
Merge branch 'master' into message_display_rework
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java b/src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java index f28dee36..6c546fee 100644 --- a/src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java +++ b/src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java @@ -220,8 +220,12 @@ public class HttpUploadConnection implements Transferable { fail(); } } catch (IOException e) { - errorStream = connection.getErrorStream(); - Logging.e("httpupload", "http response: " + new Scanner(errorStream).useDelimiter("\\A").next() + ", exception message: " + e.getMessage()); + errorStream = (null != connection) ? connection.getErrorStream() : null; + String httpResponseMessage = null; + if (null != errorStream) { + httpResponseMessage = new Scanner(errorStream).useDelimiter("\\A").next(); + } + Logging.e("httpupload", ((null != httpResponseMessage) ? ("http response: " + httpResponseMessage + ", ") : "") + "exception message: " + e.getMessage()); fail(); } finally { StreamUtil.close(os); |