From eda5a98448ec0db825f1a60aa53031417c85888e Mon Sep 17 00:00:00 2001 From: steckbrief Date: Mon, 28 Mar 2016 23:15:24 +0200 Subject: Implements FS#176: error logging for httpupload improved --- .../thedevstack/conversationsplus/http/HttpUploadConnection.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main') 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(); } -- cgit v1.2.3 From f2e361d273c228a5007c4a3e257b0b77d5d990d4 Mon Sep 17 00:00:00 2001 From: steckbrief Date: Mon, 28 Mar 2016 23:17:24 +0200 Subject: Fixes FS#170: Message Details: Status display has different Text color --- src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java | 2 +- .../conversationsplus/ui/dialogs/MessageDetailsDialog.java | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java index fb8aedef..fed3049b 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/XmppActivity.java @@ -363,7 +363,7 @@ public abstract class XmppActivity extends Activity { mPrimaryTextColor = getResources().getColor(R.color.primaryText); mSecondaryTextColor = getResources().getColor(R.color.secondaryText); mTertiaryTextColor = getResources().getColor(R.color.black12); - mColorRed = getResources().getColor(R.color.warning); + mColorRed = getResources().getColor(R.color.error); mColorOrange = getResources().getColor(R.color.orange500); mColorGreen = getResources().getColor(R.color.online); mPrimaryColor = getResources().getColor(R.color.primary); diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java index 2e7e8354..9ef51dd4 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java @@ -74,7 +74,6 @@ public class MessageDetailsDialog extends AbstractAlertDialog { protected void displayMessageStatusInfo(View view, Message message) { TextView msgStatusTextView = (TextView) view.findViewById(R.id.dlgMsgDetMsgStatus); int msgStatusResId; - int msgStatusColorResId = R.color.primaryText; switch (message.getStatus()) { case Message.STATUS_WAITING: msgStatusResId = R.string.dlg_msg_details_msg_status_waiting; @@ -87,7 +86,7 @@ public class MessageDetailsDialog extends AbstractAlertDialog { break; case Message.STATUS_SEND_FAILED: msgStatusResId = R.string.dlg_msg_details_msg_status_failed; - msgStatusColorResId = R.color.error; + msgStatusTextView.setTextColor(getContext().getResources().getColor(R.color.error)); break; case Message.STATUS_RECEIVED: msgStatusResId = R.string.dlg_msg_details_msg_status_received; @@ -99,7 +98,6 @@ public class MessageDetailsDialog extends AbstractAlertDialog { msgStatusResId = R.string.dlg_msg_details_msg_status_sent; } msgStatusTextView.setText(msgStatusResId); - msgStatusTextView.setTextColor(getContext().getResources().getColor(msgStatusColorResId)); } /** -- cgit v1.2.3