diff options
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java b/src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java index 4cf7e282..f28dee36 100644 --- a/src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java +++ b/src/main/java/de/thedevstack/conversationsplus/http/HttpUploadConnection.java @@ -11,6 +11,7 @@ import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; +import java.util.Scanner; import javax.net.ssl.HttpsURLConnection; @@ -154,6 +155,7 @@ public class HttpUploadConnection implements Transferable { private void upload() { OutputStream os = null; + InputStream errorStream = null; HttpURLConnection connection = null; PowerManager.WakeLock wakeLock = mHttpConnectionManager.createWakeLock("http_upload_"+message.getUuid()); try { @@ -213,13 +215,17 @@ public class HttpUploadConnection implements Transferable { mXmppConnectionService.resendMessage(message, delayed); } } else { + errorStream = connection.getErrorStream(); + Logging.e("httpupload", "file upload failed: http code (" + code + ") " + new Scanner(errorStream).useDelimiter("\\A").next()); fail(); } } catch (IOException e) { - Logging.d(Config.LOGTAG, e.getMessage()); + errorStream = connection.getErrorStream(); + Logging.e("httpupload", "http response: " + new Scanner(errorStream).useDelimiter("\\A").next() + ", exception message: " + e.getMessage()); fail(); } finally { StreamUtil.close(os); + StreamUtil.close(errorStream); if (connection != null) { connection.disconnect(); } |