From d9bde84daf19fd90eb1d45a68301011cacece6e6 Mon Sep 17 00:00:00 2001 From: Philip Whitehouse Date: Sat, 18 Mar 2017 17:47:32 +0000 Subject: [PATCH] Fix Exception logging Timber lint errors --- .../src/main/java/com/fsck/k9/mail/internet/TextBody.java | 2 +- .../main/java/com/fsck/k9/mail/store/imap/ImapFolder.java | 8 ++++---- .../java/com/fsck/k9/mail/store/webdav/WebDavFolder.java | 6 +++--- .../java/com/fsck/k9/mail/store/webdav/WebDavStore.java | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/k9mail-library/src/main/java/com/fsck/k9/mail/internet/TextBody.java b/k9mail-library/src/main/java/com/fsck/k9/mail/internet/TextBody.java index 5e2273f0c..b0df752eb 100644 --- a/k9mail-library/src/main/java/com/fsck/k9/mail/internet/TextBody.java +++ b/k9mail-library/src/main/java/com/fsck/k9/mail/internet/TextBody.java @@ -67,7 +67,7 @@ public class TextBody implements Body, SizeAware { } return new ByteArrayInputStream(b); } catch (UnsupportedEncodingException uee) { - Timber.e(uee, "Unsupported charset: " + charset); + Timber.e(uee, "Unsupported charset: %s", charset); return null; } } diff --git a/k9mail-library/src/main/java/com/fsck/k9/mail/store/imap/ImapFolder.java b/k9mail-library/src/main/java/com/fsck/k9/mail/store/imap/ImapFolder.java index 7d782bcce..398548f22 100644 --- a/k9mail-library/src/main/java/com/fsck/k9/mail/store/imap/ImapFolder.java +++ b/k9mail-library/src/main/java/com/fsck/k9/mail/store/imap/ImapFolder.java @@ -161,7 +161,7 @@ class ImapFolder extends Folder { } catch (IOException ioe) { throw ioExceptionHandler(connection, ioe); } catch (MessagingException me) { - Timber.e(me, "Unable to open connection for " + getLogId(), me); + Timber.e(me, "Unable to open connection for %s", getLogId()); throw me; } } @@ -901,7 +901,7 @@ class ImapFolder extends Folder { parseBodyStructure(bs, message, "TEXT"); } catch (MessagingException e) { if (K9MailLib.isDebug()) { - Timber.d(e, "Error handling message for " + getLogId(), e); + Timber.d(e, "Error handling message for %s", getLogId()); } message.setBody(null); } @@ -1322,7 +1322,7 @@ class ImapFolder extends Folder { return null; } } catch (Exception e) { - Timber.e(e, "Exception while updated push state for " + getLogId()); + Timber.e(e, "Exception while updated push state for %s", getLogId()); return null; } } @@ -1354,7 +1354,7 @@ class ImapFolder extends Folder { } private MessagingException ioExceptionHandler(ImapConnection connection, IOException ioe) { - Timber.e(ioe, "IOException for " + getLogId()); + Timber.e(ioe, "IOException for %s", getLogId()); if (connection != null) { connection.close(); diff --git a/k9mail-library/src/main/java/com/fsck/k9/mail/store/webdav/WebDavFolder.java b/k9mail-library/src/main/java/com/fsck/k9/mail/store/webdav/WebDavFolder.java index 1104b01a7..8016d624b 100644 --- a/k9mail-library/src/main/java/com/fsck/k9/mail/store/webdav/WebDavFolder.java +++ b/k9mail-library/src/main/java/com/fsck/k9/mail/store/webdav/WebDavFolder.java @@ -413,7 +413,7 @@ class WebDavFolder extends Folder { wdMessage.parse(istream); } catch (IOException ioe) { - Timber.e(ioe, "IOException: " + ioe.getMessage()); + Timber.e(ioe, "IOException during message parsing"); throw new MessagingException("I/O Error", ioe); } finally { IOUtils.closeQuietly(reader); @@ -430,8 +430,8 @@ class WebDavFolder extends Folder { Timber.e(use, "URISyntaxException caught"); throw new MessagingException("URISyntaxException caught", use); } catch (IOException ioe) { - Timber.e(ioe, "Non-success response code loading message, response code was " + statusCode - + "\nURL: " + wdMessage.getUrl()); + Timber.e(ioe, "Non-success response code loading message, response code was %d, URL: %s", + statusCode, wdMessage.getUrl()); throw new MessagingException("Failure code " + statusCode, ioe); } diff --git a/k9mail-library/src/main/java/com/fsck/k9/mail/store/webdav/WebDavStore.java b/k9mail-library/src/main/java/com/fsck/k9/mail/store/webdav/WebDavStore.java index 32d421c3d..b2e1f252d 100644 --- a/k9mail-library/src/main/java/com/fsck/k9/mail/store/webdav/WebDavStore.java +++ b/k9mail-library/src/main/java/com/fsck/k9/mail/store/webdav/WebDavStore.java @@ -813,10 +813,10 @@ public class WebDavStore extends RemoteStore { Scheme s = new Scheme("https", new WebDavSocketFactory(hostname, 443), 443); reg.register(s); } catch (NoSuchAlgorithmException nsa) { - Timber.e(nsa, "NoSuchAlgorithmException in getHttpClient: "); + Timber.e(nsa, "NoSuchAlgorithmException in getHttpClient"); throw new MessagingException("NoSuchAlgorithmException in getHttpClient: ", nsa); } catch (KeyManagementException kme) { - Timber.e(kme, "KeyManagementException in getHttpClient: " + kme); + Timber.e(kme, "KeyManagementException in getHttpClient"); throw new MessagingException("KeyManagementException in getHttpClient: ", kme); } }