aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2016-04-20 21:32:03 +0200
committersteckbrief <steckbrief@chefmail.de>2016-04-20 21:32:03 +0200
commit70938a31a0e78203449d769fa5bda15ce73d1ed4 (patch)
treed789c0c44b26bdeeedde286ab3e09a67c3dd0e5b /src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java
parent58572ba858835437011d2f450bd90fb93455b5c9 (diff)
parent7df96caedbbb96a28d4f7e07fa2d159c8ca1373f (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.java8
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);