From e19f7426785c2304440c6e9c423da6a48ebf99ee Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Mon, 10 Jan 2011 20:12:08 +0000 Subject: [PATCH] Consolidate exception catching in processSourceMessage into a single try/catch block. Add error logging if we do have an exception. --- src/com/fsck/k9/activity/MessageCompose.java | 40 ++++++-------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/src/com/fsck/k9/activity/MessageCompose.java b/src/com/fsck/k9/activity/MessageCompose.java index 3bfb92ea3..a0f641027 100644 --- a/src/com/fsck/k9/activity/MessageCompose.java +++ b/src/com/fsck/k9/activity/MessageCompose.java @@ -1675,9 +1675,9 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc private void processSourceMessage(Message message) { String action = getIntent().getAction(); - if (ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action)) + try { - try + if (ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action)) { if (message.getSubject() != null) { @@ -1821,17 +1821,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc } } } - catch (MessagingException me) - { - /* - * This really should not happen at this point but if it does it's okay. - * The user can continue composing their message. - */ - } - } - else if (ACTION_FORWARD.equals(action)) - { - try + else if (ACTION_FORWARD.equals(action)) { if (message.getSubject() != null && !message.getSubject().toLowerCase().startsWith("fwd:")) { @@ -1892,17 +1882,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc } } } - catch (MessagingException me) - { - /* - * This really should not happen at this point but if it does it's okay. - * The user can continue composing their message. - */ - } - } - else if (ACTION_EDIT_DRAFT.equals(action)) - { - try + else if (ACTION_EDIT_DRAFT.equals(action)) { mDraftUid = message.getUid(); mSubjectView.setText(message.getSubject()); @@ -2039,10 +2019,14 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc } } } - catch (MessagingException me) - { - // TODO - } + } + catch (MessagingException me) + { + /** + * Let the user continue composing their message even if we have a problem processing + * the source message. Log it as an error, though. + */ + Log.e(K9.LOG_TAG, "Error while processing source message: ", me); } mSourceMessageProcessed = true; mDraftNeedsSaving = false;