remove accidental static imports

This commit is contained in:
Vincent Breitmoser 2017-03-02 13:14:54 +01:00
parent ff274e2978
commit 7309132659
56 changed files with 251 additions and 260 deletions

View file

@ -760,7 +760,7 @@ public class Account implements BaseAccount, StoreConfig {
try { try {
getLocalStore().resetVisibleLimits(getDisplayCount()); getLocalStore().resetVisibleLimits(getDisplayCount());
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Unable to reset visible limits", e); Timber.e(e, "Unable to reset visible limits");
} }
} }
@ -953,8 +953,8 @@ public class Account implements BaseAccount, StoreConfig {
switchLocalStorage(id); switchLocalStorage(id);
successful = true; successful = true;
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Switching local storage provider from " + Timber.e(e, "Switching local storage provider from " +
mLocalStorageProviderId + " to " + id + " failed.", e); mLocalStorageProviderId + " to " + id + " failed.");
} }
// if migration to/from SD-card failed once, it will fail again. // if migration to/from SD-card failed once, it will fail again.

View file

@ -24,7 +24,6 @@ import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.StrictMode; import android.os.StrictMode;
import android.text.format.Time; import android.text.format.Time;
import timber.log.Timber;
import com.fsck.k9.Account.SortType; import com.fsck.k9.Account.SortType;
import com.fsck.k9.activity.MessageCompose; import com.fsck.k9.activity.MessageCompose;
@ -47,9 +46,6 @@ import com.fsck.k9.service.StorageGoneReceiver;
import com.fsck.k9.widget.list.MessageListWidgetProvider; import com.fsck.k9.widget.list.MessageListWidgetProvider;
import timber.log.Timber; import timber.log.Timber;
import static timber.log.Timber.i;
import static timber.log.Timber.v;
public class K9 extends Application { public class K9 extends Application {
/** /**
@ -421,7 +417,7 @@ public class K9 extends Application {
try { try {
queue.put(new Handler()); queue.put(new Handler());
} catch (InterruptedException e) { } catch (InterruptedException e) {
Timber.e("", e); Timber.e(e, "");
} }
Looper.loop(); Looper.loop();
} }
@ -431,13 +427,13 @@ public class K9 extends Application {
try { try {
final Handler storageGoneHandler = queue.take(); final Handler storageGoneHandler = queue.take();
registerReceiver(receiver, filter, null, storageGoneHandler); registerReceiver(receiver, filter, null, storageGoneHandler);
i("Registered: unmount receiver"); Timber.i("Registered: unmount receiver");
} catch (InterruptedException e) { } catch (InterruptedException e) {
Timber.e("Unable to register unmount receiver", e); Timber.e(e, "Unable to register unmount receiver");
} }
registerReceiver(new ShutdownReceiver(), new IntentFilter(Intent.ACTION_SHUTDOWN)); registerReceiver(new ShutdownReceiver(), new IntentFilter(Intent.ACTION_SHUTDOWN));
i("Registered: shutdown receiver"); Timber.i("Registered: shutdown receiver");
} }
public static void save(StorageEditor editor) { public static void save(StorageEditor editor) {
@ -582,7 +578,7 @@ public class K9 extends Application {
UnreadWidgetProvider.updateUnreadCount(K9.this); UnreadWidgetProvider.updateUnreadCount(K9.this);
} catch (Exception e) { } catch (Exception e) {
if (K9.DEBUG) { if (K9.DEBUG) {
Timber.e("Error while updating unread widget(s)", e); Timber.e(e, "Error while updating unread widget(s)");
} }
} }
} }
@ -594,7 +590,7 @@ public class K9 extends Application {
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
throw e; throw e;
} else if (K9.DEBUG) { } else if (K9.DEBUG) {
Timber.e("Error while updating message list widget", e); Timber.e(e, "Error while updating message list widget");
} }
} }
} }
@ -804,12 +800,12 @@ public class K9 extends Application {
synchronized (observers) { synchronized (observers) {
for (final ApplicationAware aware : observers) { for (final ApplicationAware aware : observers) {
if (K9.DEBUG) { if (K9.DEBUG) {
v("Initializing observer: " + aware); Timber.v("Initializing observer: " + aware);
} }
try { try {
aware.initializeComponent(this); aware.initializeComponent(this);
} catch (Exception e) { } catch (Exception e) {
Timber.w("Failure when notifying " + aware, e); Timber.w(e, "Failure when notifying " + aware);
} }
} }

View file

@ -130,7 +130,7 @@ public class Preferences {
try { try {
RemoteStore.removeInstance(account); RemoteStore.removeInstance(account);
} catch (Exception e) { } catch (Exception e) {
Timber.e("Failed to reset remote store for account " + account.getUuid(), e); Timber.e(e, "Failed to reset remote store for account " + account.getUuid());
} }
LocalStore.removeAccount(account); LocalStore.removeAccount(account);
@ -178,8 +178,8 @@ public class Preferences {
try { try {
return Enum.valueOf(defaultEnum.getDeclaringClass(), stringPref); return Enum.valueOf(defaultEnum.getDeclaringClass(), stringPref);
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
Timber.w("Unable to convert preference key [" + key + Timber.w(ex, "Unable to convert preference key [" + key +
"] value [" + stringPref + "] to enum of type " + defaultEnum.getDeclaringClass(), ex); "] value [" + stringPref + "] to enum of type " + defaultEnum.getDeclaringClass());
return defaultEnum; return defaultEnum;
} }

View file

@ -261,7 +261,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
accountStatusChanged(account, stats); accountStatusChanged(account, stats);
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("Unable to get account stats", e); Timber.e(e, "Unable to get account stats");
} }
} }
@Override @Override
@ -995,7 +995,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
// Get list of folders from remote server // Get list of folders from remote server
MessagingController.getInstance(mApplication).listFolders(mAccount, true, null); MessagingController.getInstance(mApplication).listFolders(mAccount, true, null);
} catch (Exception e) { } catch (Exception e) {
Timber.e("Something went while setting account passwords", e); Timber.e(e, "Something went while setting account passwords");
} }
return null; return null;
} }
@ -1926,7 +1926,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
mFileName = SettingsExporter.exportToFile(mContext, mIncludeGlobals, mFileName = SettingsExporter.exportToFile(mContext, mIncludeGlobals,
mAccountUuids); mAccountUuids);
} catch (SettingsImportExportException e) { } catch (SettingsImportExportException e) {
Timber.w("Exception during export", e); Timber.w(e, "Exception during export");
return false; return false;
} }
return true; return true;
@ -1993,13 +1993,13 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
} }
} }
} catch (SettingsImportExportException e) { } catch (SettingsImportExportException e) {
Timber.w("Exception during import", e); Timber.w(e, "Exception during import");
return false; return false;
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
Timber.w("Couldn't open import file", e); Timber.w(e, "Couldn't open import file");
return false; return false;
} catch (Exception e) { } catch (Exception e) {
Timber.w("Unknown error", e); Timber.w(e, "Unknown error");
return false; return false;
} }
return true; return true;
@ -2066,7 +2066,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
} }
} }
} catch (SettingsImportExportException e) { } catch (SettingsImportExportException e) {
Timber.w("Exception during export", e); Timber.w(e, "Exception during export");
return false; return false;
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
Timber.w("Couldn't read content from URI " + mUri); Timber.w("Couldn't read content from URI " + mUri);

View file

@ -813,7 +813,7 @@ public class FolderList extends K9ListActivity {
} }
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("Exception while populating folder", e); Timber.e(e, "Exception while populating folder");
} finally { } finally {
if (localFolder != null) { if (localFolder != null) {
localFolder.close(); localFolder.close();

View file

@ -1157,7 +1157,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
* Let the user continue composing their message even if we have a problem processing * Let the user continue composing their message even if we have a problem processing
* the source message. Log it as an error, though. * the source message. Log it as an error, though.
*/ */
Timber.e("Error while processing source message: ", me); Timber.e(me, "Error while processing source message: ");
} finally { } finally {
relatedMessageProcessed = true; relatedMessageProcessed = true;
changesMadeSinceLastSave = false; changesMadeSinceLastSave = false;
@ -1352,7 +1352,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
contacts.markAsContacted(message.getRecipients(RecipientType.BCC)); contacts.markAsContacted(message.getRecipients(RecipientType.BCC));
updateReferencedMessage(); updateReferencedMessage();
} catch (Exception e) { } catch (Exception e) {
Timber.e("Failed to mark contact as contacted.", e); Timber.e(e, "Failed to mark contact as contacted.");
} }
MessagingController.getInstance(context).sendMessage(account, message, null); MessagingController.getInstance(context).sendMessage(account, message, null);
@ -1481,7 +1481,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
@Override @Override
public void onMessageBuildException(MessagingException me) { public void onMessageBuildException(MessagingException me) {
Timber.e("Error sending message", me); Timber.e(me, "Error sending message");
Toast.makeText(MessageCompose.this, Toast.makeText(MessageCompose.this,
getString(R.string.send_failed_reason, me.getLocalizedMessage()), Toast.LENGTH_LONG).show(); getString(R.string.send_failed_reason, me.getLocalizedMessage()), Toast.LENGTH_LONG).show();
currentMessageBuilder = null; currentMessageBuilder = null;
@ -1494,7 +1494,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
try { try {
startIntentSenderForResult(pendingIntent.getIntentSender(), requestCode, null, 0, 0, 0); startIntentSenderForResult(pendingIntent.getIntentSender(), requestCode, null, 0, 0, 0);
} catch (SendIntentException e) { } catch (SendIntentException e) {
Timber.e("Error starting pending intent from builder!", e); Timber.e(e, "Error starting pending intent from builder!");
} }
} }
@ -1518,7 +1518,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
} catch (MessagingException e) { } catch (MessagingException e) {
// Hm, if we couldn't populate the UI after source reprocessing, let's just delete it? // Hm, if we couldn't populate the UI after source reprocessing, let's just delete it?
quotedMessagePresenter.showOrHideQuotedText(QuotedTextMode.HIDE); quotedMessagePresenter.showOrHideQuotedText(QuotedTextMode.HIDE);
Timber.e("Could not re-process source message; deleting quoted text to be safe.", e); Timber.e(e, "Could not re-process source message; deleting quoted text to be safe.");
} }
updateMessageFormat(); updateMessageFormat();
} else { } else {
@ -1563,7 +1563,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
requestCode |= REQUEST_MASK_LOADER_HELPER; requestCode |= REQUEST_MASK_LOADER_HELPER;
startIntentSenderForResult(si, requestCode, fillIntent, flagsMask, flagValues, extraFlags); startIntentSenderForResult(si, requestCode, fillIntent, flagsMask, flagValues, extraFlags);
} catch (SendIntentException e) { } catch (SendIntentException e) {
Timber.e("Irrecoverable error calling PendingIntent!", e); Timber.e(e, "Irrecoverable error calling PendingIntent!");
} }
} }

View file

@ -678,7 +678,7 @@ public class RecipientPresenter implements PermissionPingCallback {
// TODO handle error case better // TODO handle error case better
recipientMvpView.showErrorOpenPgpConnection(); recipientMvpView.showErrorOpenPgpConnection();
cryptoProviderState = CryptoProviderState.ERROR; cryptoProviderState = CryptoProviderState.ERROR;
Timber.e("error connecting to crypto provider!", e); Timber.e(e, "error connecting to crypto provider!");
updateCryptoStatus(); updateCryptoStatus();
} }

View file

@ -78,7 +78,7 @@ public class AttachmentContentLoader extends AsyncTaskLoader<Attachment> {
cachedResultAttachment = sourceAttachment.deriveWithLoadComplete(file.getAbsolutePath()); cachedResultAttachment = sourceAttachment.deriveWithLoadComplete(file.getAbsolutePath());
return cachedResultAttachment; return cachedResultAttachment;
} catch (IOException e) { } catch (IOException e) {
Timber.e("Error saving attachment!", e); Timber.e(e, "Error saving attachment!");
} }
cachedResultAttachment = sourceAttachment.deriveWithLoadCancelled(); cachedResultAttachment = sourceAttachment.deriveWithLoadCancelled();

View file

@ -219,7 +219,7 @@ public class AccountSettings extends K9PreferenceActivity {
mIsExpungeCapable = store.isExpungeCapable(); mIsExpungeCapable = store.isExpungeCapable();
mIsSeenFlagSupported = store.isSeenFlagSupported(); mIsSeenFlagSupported = store.isSeenFlagSupported();
} catch (Exception e) { } catch (Exception e) {
Timber.e("Could not get remote store", e); Timber.e(e, "Could not get remote store");
} }
addPreferencesFromResource(R.xml.account_settings_preferences); addPreferencesFromResource(R.xml.account_settings_preferences);

View file

@ -125,7 +125,7 @@ public class AccountSetupAccountType extends K9Activity implements OnClickListen
} }
private void failure(Exception use) { private void failure(Exception use) {
Timber.e("Failure", use); Timber.e(use, "Failure");
String toastText = getString(R.string.account_setup_bad_uri, use.getMessage()); String toastText = getString(R.string.account_setup_bad_uri, use.getMessage());
Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG); Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG);

View file

@ -232,7 +232,7 @@ public class AccountSetupBasics extends K9Activity
try { try {
name = getDefaultAccountName(); name = getDefaultAccountName();
} catch (Exception e) { } catch (Exception e) {
Timber.e("Could not get default account name", e); Timber.e(e, "Could not get default account name");
} }
if (name == null) { if (name == null) {
@ -496,7 +496,7 @@ public class AccountSetupBasics extends K9Activity
} }
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("Error while trying to load provider settings.", e); Timber.e(e, "Error while trying to load provider settings.");
} }
return null; return null;
} }

View file

@ -101,7 +101,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
} }
private void handleCertificateValidationException(CertificateValidationException cve) { private void handleCertificateValidationException(CertificateValidationException cve) {
Timber.e("Error while testing settings", cve); Timber.e(cve, "Error while testing settings");
X509Certificate[] chain = cve.getCertChain(); X509Certificate[] chain = cve.getCertChain();
// Avoid NullPointerException in acceptKeyDialog() // Avoid NullPointerException in acceptKeyDialog()
@ -155,7 +155,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
try { try {
sha1 = MessageDigest.getInstance("SHA-1"); sha1 = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
Timber.e("Error while initializing MessageDigest", e); Timber.e(e, "Error while initializing MessageDigest");
} }
final X509Certificate[] chain = ex.getCertChain(); final X509Certificate[] chain = ex.getCertChain();
@ -232,7 +232,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
} }
} catch (Exception e1) { } catch (Exception e1) {
// don't fail just because of subjectAltNames // don't fail just because of subjectAltNames
Timber.w("cannot display SubjectAltNames in dialog", e1); Timber.w(e1, "cannot display SubjectAltNames in dialog");
} }
chainInfo.append("Issuer: ").append(chain[i].getIssuerDN().toString()).append("\n"); chainInfo.append("Issuer: ").append(chain[i].getIssuerDN().toString()).append("\n");
@ -242,7 +242,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
String sha1sum = Hex.encodeHex(sha1.digest(chain[i].getEncoded())); String sha1sum = Hex.encodeHex(sha1.digest(chain[i].getEncoded()));
chainInfo.append("Fingerprint (SHA-1): ").append(sha1sum).append("\n"); chainInfo.append("Fingerprint (SHA-1): ").append(sha1sum).append("\n");
} catch (CertificateEncodingException e) { } catch (CertificateEncodingException e) {
Timber.e("Error while encoding certificate", e); Timber.e(e, "Error while encoding certificate");
} }
} }
} }
@ -429,14 +429,14 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
finish(); finish();
} catch (AuthenticationFailedException afe) { } catch (AuthenticationFailedException afe) {
Timber.e("Error while testing settings", afe); Timber.e(afe, "Error while testing settings");
showErrorDialog( showErrorDialog(
R.string.account_setup_failed_dlg_auth_message_fmt, R.string.account_setup_failed_dlg_auth_message_fmt,
afe.getMessage() == null ? "" : afe.getMessage()); afe.getMessage() == null ? "" : afe.getMessage());
} catch (CertificateValidationException cve) { } catch (CertificateValidationException cve) {
handleCertificateValidationException(cve); handleCertificateValidationException(cve);
} catch (Exception e) { } catch (Exception e) {
Timber.e("Error while testing settings", e); Timber.e(e, "Error while testing settings");
String message = e.getMessage() == null ? "" : e.getMessage(); String message = e.getMessage() == null ? "" : e.getMessage();
showErrorDialog(R.string.account_setup_failed_dlg_server_message_fmt, message); showErrorDialog(R.string.account_setup_failed_dlg_server_message_fmt, message);
} }

View file

@ -494,7 +494,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
Store store = mAccount.getRemoteStore(); Store store = mAccount.getRemoteStore();
isPushCapable = store.isPushCapable(); isPushCapable = store.isPushCapable();
} catch (Exception e) { } catch (Exception e) {
Timber.e("Could not get remote store", e); Timber.e(e, "Could not get remote store");
} }
if (isPushCapable && mAccount.getFolderPushMode() != FolderMode.NONE) { if (isPushCapable && mAccount.getFolderPushMode() != FolderMode.NONE) {
MailService.actionRestartPushers(this, null); MailService.actionRestartPushers(this, null);
@ -602,7 +602,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
} }
private void failure(Exception use) { private void failure(Exception use) {
Timber.e("Failure", use); Timber.e(use, "Failure");
String toastText = getString(R.string.account_setup_bad_uri, use.getMessage()); String toastText = getString(R.string.account_setup_bad_uri, use.getMessage());
Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG); Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG);

View file

@ -115,7 +115,7 @@ public class AccountSetupOptions extends K9Activity implements OnClickListener {
Store store = mAccount.getRemoteStore(); Store store = mAccount.getRemoteStore();
isPushCapable = store.isPushCapable(); isPushCapable = store.isPushCapable();
} catch (Exception e) { } catch (Exception e) {
Timber.e("Could not get remote store", e); Timber.e(e, "Could not get remote store");
} }

View file

@ -487,7 +487,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
} }
private void failure(Exception use) { private void failure(Exception use) {
Timber.e("Failure", use); Timber.e(use, "Failure");
String toastText = getString(R.string.account_setup_bad_uri, use.getMessage()); String toastText = getString(R.string.account_setup_bad_uri, use.getMessage());
Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG); Toast toast = Toast.makeText(getApplication(), toastText, Toast.LENGTH_LONG);

View file

@ -62,7 +62,7 @@ public class FolderSettings extends K9PreferenceActivity {
mFolder = localStore.getFolder(folderName); mFolder = localStore.getFolder(folderName);
mFolder.open(Folder.OPEN_MODE_RW); mFolder.open(Folder.OPEN_MODE_RW);
} catch (MessagingException me) { } catch (MessagingException me) {
Timber.e("Unable to edit folder " + folderName + " preferences", me); Timber.e(me, "Unable to edit folder " + folderName + " preferences");
return; return;
} }
@ -71,7 +71,7 @@ public class FolderSettings extends K9PreferenceActivity {
Store store = mAccount.getRemoteStore(); Store store = mAccount.getRemoteStore();
isPushCapable = store.isPushCapable(); isPushCapable = store.isPushCapable();
} catch (Exception e) { } catch (Exception e) {
Timber.e("Could not get remote store", e); Timber.e(e, "Could not get remote store");
} }
addPreferencesFromResource(R.xml.folder_settings_preferences); addPreferencesFromResource(R.xml.folder_settings_preferences);
@ -167,7 +167,7 @@ public class FolderSettings extends K9PreferenceActivity {
try { try {
saveSettings(); saveSettings();
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Saving folder settings failed", e); Timber.e(e, "Saving folder settings failed");
} }
super.onPause(); super.onPause();

View file

@ -42,7 +42,6 @@ import android.os.Process;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.VisibleForTesting; import android.support.annotation.VisibleForTesting;
import timber.log.Timber;
import com.fsck.k9.Account; import com.fsck.k9.Account;
import com.fsck.k9.Account.DeletePolicy; import com.fsck.k9.Account.DeletePolicy;
@ -109,10 +108,6 @@ import timber.log.Timber;
import static com.fsck.k9.K9.MAX_SEND_ATTEMPTS; import static com.fsck.k9.K9.MAX_SEND_ATTEMPTS;
import static com.fsck.k9.mail.Flag.X_REMOTE_COPY_STARTED; import static com.fsck.k9.mail.Flag.X_REMOTE_COPY_STARTED;
import static timber.log.Timber.e;
import static timber.log.Timber.i;
import static timber.log.Timber.v;
import static timber.log.Timber.w;
/** /**
@ -205,7 +200,7 @@ public class MessagingController {
commandDescription = command.description; commandDescription = command.description;
if (K9.DEBUG) { if (K9.DEBUG) {
i("Running command '" + command.description + "', seq = " + command.sequence + Timber.i("Running command '" + command.description + "', seq = " + command.sequence +
"(" + (command.isForegroundPriority ? "foreground" : "background") + "priority)"); "(" + (command.isForegroundPriority ? "foreground" : "background") + "priority)");
} }
@ -220,7 +215,7 @@ public class MessagingController {
sleep(30 * 1000); sleep(30 * 1000);
queuedCommands.put(command); queuedCommands.put(command);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e("interrupted while putting a pending command for" Timber.e("interrupted while putting a pending command for"
+ " an unavailable account back into the queue." + " an unavailable account back into the queue."
+ " THIS SHOULD NEVER HAPPEN."); + " THIS SHOULD NEVER HAPPEN.");
} }
@ -229,11 +224,11 @@ public class MessagingController {
} }
if (K9.DEBUG) { if (K9.DEBUG) {
i(" Command '" + command.description + "' completed"); Timber.i(" Command '" + command.description + "' completed");
} }
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("Error running command '" + commandDescription + "'", e); Timber.e(e, "Error running command '" + commandDescription + "'");
} }
} }
} }
@ -384,7 +379,7 @@ public class MessagingController {
} }
List<LocalFolder> localFolders = null; List<LocalFolder> localFolders = null;
if (!account.isAvailable(context)) { if (!account.isAvailable(context)) {
i("not listing folders of unavailable account"); Timber.i("not listing folders of unavailable account");
} else { } else {
try { try {
LocalStore localStore = account.getLocalStore(); LocalStore localStore = account.getLocalStore();
@ -571,7 +566,7 @@ public class MessagingController {
+ ", folderName = " + folderName + ", folderName = " + folderName
+ ", query = " + query + ", query = " + query
+ ")"; + ")";
i(msg); Timber.i(msg);
} }
return threadPool.submit(new Runnable() { return threadPool.submit(new Runnable() {
@ -609,7 +604,7 @@ public class MessagingController {
List<Message> messages = remoteFolder.search(query, requiredFlags, forbiddenFlags); List<Message> messages = remoteFolder.search(query, requiredFlags, forbiddenFlags);
if (K9.DEBUG) { if (K9.DEBUG) {
i("Remote search got " + messages.size() + " results"); Timber.i("Remote search got " + messages.size() + " results");
} }
// There's no need to fetch messages already completely downloaded // There's no need to fetch messages already completely downloaded
@ -634,9 +629,9 @@ public class MessagingController {
} catch (Exception e) { } catch (Exception e) {
if (Thread.currentThread().isInterrupted()) { if (Thread.currentThread().isInterrupted()) {
Timber.i("Caught exception on aborted remote search; safe to ignore.", e); Timber.i(e, "Caught exception on aborted remote search; safe to ignore.");
} else { } else {
Timber.e("Could not complete remote search", e); Timber.e(e, "Could not complete remote search");
if (listener != null) { if (listener != null) {
listener.remoteSearchFailed(null, e.getMessage()); listener.remoteSearchFailed(null, e.getMessage());
} }
@ -674,7 +669,7 @@ public class MessagingController {
loadSearchResultsSynchronous(messages, localFolder, remoteFolder, listener); loadSearchResultsSynchronous(messages, localFolder, remoteFolder, listener);
} catch (MessagingException e) { } catch (MessagingException e) {
e("Exception in loadSearchResults: " + e); Timber.e("Exception in loadSearchResults: " + e);
addErrorMessage(account, null, e); addErrorMessage(account, null, e);
} finally { } finally {
if (listener != null) { if (listener != null) {
@ -750,7 +745,7 @@ public class MessagingController {
LocalFolder tLocalFolder = null; LocalFolder tLocalFolder = null;
if (K9.DEBUG) { if (K9.DEBUG) {
i("Synchronizing folder " + account.getDescription() + ":" + folder); Timber.i("Synchronizing folder " + account.getDescription() + ":" + folder);
} }
for (MessagingListener l : getListeners(listener)) { for (MessagingListener l : getListeners(listener)) {
@ -778,7 +773,7 @@ public class MessagingController {
} catch (Exception e) { } catch (Exception e) {
addErrorMessage(account, null, e); addErrorMessage(account, null, e);
Timber.e("Failure processing command, but allow message sync attempt", e); Timber.e(e, "Failure processing command, but allow message sync attempt");
commandException = e; commandException = e;
} }
@ -787,7 +782,7 @@ public class MessagingController {
* the uids within the list. * the uids within the list.
*/ */
if (K9.DEBUG) { if (K9.DEBUG) {
v("SYNC: About to get local folder " + folder); Timber.v("SYNC: About to get local folder " + folder);
} }
final LocalStore localStore = account.getLocalStore(); final LocalStore localStore = account.getLocalStore();
@ -799,14 +794,14 @@ public class MessagingController {
if (providedRemoteFolder != null) { if (providedRemoteFolder != null) {
if (K9.DEBUG) { if (K9.DEBUG) {
v("SYNC: using providedRemoteFolder " + folder); Timber.v("SYNC: using providedRemoteFolder " + folder);
} }
remoteFolder = providedRemoteFolder; remoteFolder = providedRemoteFolder;
} else { } else {
Store remoteStore = account.getRemoteStore(); Store remoteStore = account.getRemoteStore();
if (K9.DEBUG) { if (K9.DEBUG) {
v("SYNC: About to get remote folder " + folder); Timber.v("SYNC: About to get remote folder " + folder);
} }
remoteFolder = remoteStore.getFolder(folder); remoteFolder = remoteStore.getFolder(folder);
@ -837,7 +832,7 @@ public class MessagingController {
* Open the remote folder. This pre-loads certain metadata like message count. * Open the remote folder. This pre-loads certain metadata like message count.
*/ */
if (K9.DEBUG) { if (K9.DEBUG) {
v("SYNC: About to open remote folder " + folder); Timber.v("SYNC: About to open remote folder " + folder);
} }
remoteFolder.open(Folder.OPEN_MODE_RW); remoteFolder.open(Folder.OPEN_MODE_RW);
@ -867,7 +862,7 @@ public class MessagingController {
Map<String, Message> remoteUidMap = new HashMap<>(); Map<String, Message> remoteUidMap = new HashMap<>();
if (K9.DEBUG) { if (K9.DEBUG) {
v("SYNC: Remote message count for folder " + folder + " is " + remoteMessageCount); Timber.v("SYNC: Remote message count for folder " + folder + " is " + remoteMessageCount);
} }
final Date earliestDate = account.getEarliestPollDate(); final Date earliestDate = account.getEarliestPollDate();
long earliestTimestamp = earliestDate != null ? earliestDate.getTime() : 0L; long earliestTimestamp = earliestDate != null ? earliestDate.getTime() : 0L;
@ -883,7 +878,7 @@ public class MessagingController {
} }
if (K9.DEBUG) { if (K9.DEBUG) {
v("SYNC: About to get messages " + remoteStart + " through " + remoteMessageCount + Timber.v("SYNC: About to get messages " + remoteStart + " through " + remoteMessageCount +
" for folder " + folder); " for folder " + folder);
} }
@ -910,7 +905,7 @@ public class MessagingController {
} }
} }
if (K9.DEBUG) { if (K9.DEBUG) {
v("SYNC: Got " + remoteUidMap.size() + " messages for folder " + folder); Timber.v("SYNC: Got " + remoteUidMap.size() + " messages for folder " + folder);
} }
for (MessagingListener l : getListeners(listener)) { for (MessagingListener l : getListeners(listener)) {
@ -980,7 +975,7 @@ public class MessagingController {
if (commandException != null) { if (commandException != null) {
String rootMessage = getRootCauseMessage(commandException); String rootMessage = getRootCauseMessage(commandException);
e("Root cause failure in " + account.getDescription() + ":" + Timber.e("Root cause failure in " + account.getDescription() + ":" +
tLocalFolder.getName() + " was '" + rootMessage + "'"); tLocalFolder.getName() + " was '" + rootMessage + "'");
localFolder.setStatus(rootMessage); localFolder.setStatus(rootMessage);
for (MessagingListener l : getListeners(listener)) { for (MessagingListener l : getListeners(listener)) {
@ -989,7 +984,7 @@ public class MessagingController {
} }
if (K9.DEBUG) { if (K9.DEBUG) {
i("Done synchronizing folder " + account.getDescription() + ":" + folder); Timber.i("Done synchronizing folder " + account.getDescription() + ":" + folder);
} }
} catch (AuthenticationFailedException e) { } catch (AuthenticationFailedException e) {
@ -999,7 +994,7 @@ public class MessagingController {
l.synchronizeMailboxFailed(account, folder, "Authentication failure"); l.synchronizeMailboxFailed(account, folder, "Authentication failure");
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("synchronizeMailbox", e); Timber.e(e, "synchronizeMailbox");
// If we don't set the last checked, it can try too often during // If we don't set the last checked, it can try too often during
// failure conditions // failure conditions
String rootMessage = getRootCauseMessage(e); String rootMessage = getRootCauseMessage(e);
@ -1008,8 +1003,8 @@ public class MessagingController {
tLocalFolder.setStatus(rootMessage); tLocalFolder.setStatus(rootMessage);
tLocalFolder.setLastChecked(System.currentTimeMillis()); tLocalFolder.setLastChecked(System.currentTimeMillis());
} catch (MessagingException me) { } catch (MessagingException me) {
Timber.e("Could not set last checked on folder " + account.getDescription() + ":" + Timber.e(e, "Could not set last checked on folder " + account.getDescription() + ":" +
tLocalFolder.getName(), e); tLocalFolder.getName());
} }
} }
@ -1018,7 +1013,7 @@ public class MessagingController {
} }
notifyUserIfCertificateProblem(account, e, true); notifyUserIfCertificateProblem(account, e, true);
addErrorMessage(account, null, e); addErrorMessage(account, null, e);
e("Failed synchronizing folder " + account.getDescription() + ":" + folder + " @ " + new Date()); Timber.e("Failed synchronizing folder " + account.getDescription() + ":" + folder + " @ " + new Date());
} finally { } finally {
if (providedRemoteFolder == null) { if (providedRemoteFolder == null) {
@ -1071,7 +1066,7 @@ public class MessagingController {
l.synchronizeMailboxFinished(account, folder, 0, 0); l.synchronizeMailboxFinished(account, folder, 0, 0);
} }
if (K9.DEBUG) { if (K9.DEBUG) {
i("Done synchronizing folder " + folder); Timber.i("Done synchronizing folder " + folder);
} }
return false; return false;
@ -1122,7 +1117,7 @@ public class MessagingController {
unreadBeforeStart = stats.unreadMessageCount; unreadBeforeStart = stats.unreadMessageCount;
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Unable to getUnreadMessageCount for account: " + account, e); Timber.e(e, "Unable to getUnreadMessageCount for account: " + account);
} }
List<Message> syncFlagMessages = new ArrayList<>(); List<Message> syncFlagMessages = new ArrayList<>();
@ -1271,7 +1266,7 @@ public class MessagingController {
boolean flagSyncOnly) throws MessagingException { boolean flagSyncOnly) throws MessagingException {
if (message.isSet(Flag.DELETED)) { if (message.isSet(Flag.DELETED)) {
if (K9.DEBUG) { if (K9.DEBUG) {
v("Message with uid " + message.getUid() + " is marked as deleted"); Timber.v("Message with uid " + message.getUid() + " is marked as deleted");
} }
syncFlagMessages.add(message); syncFlagMessages.add(message);
return; return;
@ -1283,13 +1278,13 @@ public class MessagingController {
if (!flagSyncOnly) { if (!flagSyncOnly) {
if (!message.isSet(Flag.X_DOWNLOADED_FULL) && !message.isSet(Flag.X_DOWNLOADED_PARTIAL)) { if (!message.isSet(Flag.X_DOWNLOADED_FULL) && !message.isSet(Flag.X_DOWNLOADED_PARTIAL)) {
if (K9.DEBUG) { if (K9.DEBUG) {
v("Message with uid " + message.getUid() + " has not yet been downloaded"); Timber.v("Message with uid " + message.getUid() + " has not yet been downloaded");
} }
unsyncedMessages.add(message); unsyncedMessages.add(message);
} else { } else {
if (K9.DEBUG) { if (K9.DEBUG) {
v("Message with uid " + message.getUid() + " is partially or fully downloaded"); Timber.v("Message with uid " + message.getUid() + " is partially or fully downloaded");
} }
// Store the updated message locally // Store the updated message locally
@ -1309,12 +1304,12 @@ public class MessagingController {
} }
} else if (!localMessage.isSet(Flag.DELETED)) { } else if (!localMessage.isSet(Flag.DELETED)) {
if (K9.DEBUG) { if (K9.DEBUG) {
v("Message with uid " + message.getUid() + " is present in the local store"); Timber.v("Message with uid " + message.getUid() + " is present in the local store");
} }
if (!localMessage.isSet(Flag.X_DOWNLOADED_FULL) && !localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL)) { if (!localMessage.isSet(Flag.X_DOWNLOADED_FULL) && !localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL)) {
if (K9.DEBUG) { if (K9.DEBUG) {
v("Message with uid " + message.getUid() Timber.v("Message with uid " + message.getUid()
+ " is not downloaded, even partially; trying again"); + " is not downloaded, even partially; trying again");
} }
@ -1328,7 +1323,7 @@ public class MessagingController {
} }
} else { } else {
if (K9.DEBUG) { if (K9.DEBUG) {
v("Local copy of message with uid " + message.getUid() + " is marked as deleted"); Timber.v("Local copy of message with uid " + message.getUid() + " is marked as deleted");
} }
} }
} }
@ -1351,7 +1346,7 @@ public class MessagingController {
if (message.isSet(Flag.DELETED) || message.olderThan(earliestDate)) { if (message.isSet(Flag.DELETED) || message.olderThan(earliestDate)) {
if (K9.DEBUG) { if (K9.DEBUG) {
if (message.isSet(Flag.DELETED)) { if (message.isSet(Flag.DELETED)) {
v("Newly downloaded message " + account + ":" + folder + ":" + Timber.v("Newly downloaded message " + account + ":" + folder + ":" +
message.getUid() message.getUid()
+ " was marked deleted on server, skipping"); + " was marked deleted on server, skipping");
} else { } else {
@ -1374,7 +1369,7 @@ public class MessagingController {
smallMessages.add(message); smallMessages.add(message);
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("Error while storing downloaded message.", e); Timber.e(e, "Error while storing downloaded message.");
addErrorMessage(account, null, e); addErrorMessage(account, null, e);
} }
} }
@ -1447,7 +1442,7 @@ public class MessagingController {
} }
if (K9.DEBUG) { if (K9.DEBUG) {
v("About to notify listeners that we got a new small message " Timber.v("About to notify listeners that we got a new small message "
+ account + ":" + folder + ":" + message.getUid()); + account + ":" + folder + ":" + message.getUid());
} }
@ -1467,7 +1462,7 @@ public class MessagingController {
} catch (MessagingException me) { } catch (MessagingException me) {
addErrorMessage(account, null, me); addErrorMessage(account, null, me);
Timber.e("SYNC: fetch small messages", me); Timber.e(me, "SYNC: fetch small messages");
} }
} }
@ -1512,7 +1507,7 @@ public class MessagingController {
downloadPartial(remoteFolder, localFolder, message); downloadPartial(remoteFolder, localFolder, message);
} }
if (K9.DEBUG) { if (K9.DEBUG) {
v("About to notify listeners that we got a new large message " Timber.v("About to notify listeners that we got a new large message "
+ account + ":" + folder + ":" + message.getUid()); + account + ":" + folder + ":" + message.getUid());
} }
// Update the listener with what we've found // Update the listener with what we've found
@ -1729,11 +1724,11 @@ public class MessagingController {
try { try {
processPendingCommandsSynchronous(account); processPendingCommandsSynchronous(account);
} catch (UnavailableStorageException e) { } catch (UnavailableStorageException e) {
i( Timber.i(
"Failed to process pending command because storage is not available - trying again later."); "Failed to process pending command because storage is not available - trying again later.");
throw new UnavailableAccountException(e); throw new UnavailableAccountException(e);
} catch (MessagingException me) { } catch (MessagingException me) {
Timber.e("processPendingCommands", me); Timber.e(me, "processPendingCommands");
addErrorMessage(account, null, me); addErrorMessage(account, null, me);
@ -1786,7 +1781,7 @@ public class MessagingController {
} catch (MessagingException me) { } catch (MessagingException me) {
if (me.isPermanentFailure()) { if (me.isPermanentFailure()) {
addErrorMessage(account, null, me); addErrorMessage(account, null, me);
e("Failure of command '" + command + "' was permanent, removing command from queue"); Timber.e("Failure of command '" + command + "' was permanent, removing command from queue");
localStore.removePendingCommand(processingCommand); localStore.removePendingCommand(processingCommand);
} else { } else {
throw me; throw me;
@ -1802,7 +1797,7 @@ public class MessagingController {
} catch (MessagingException me) { } catch (MessagingException me) {
notifyUserIfCertificateProblem(account, me, true); notifyUserIfCertificateProblem(account, me, true);
addErrorMessage(account, null, me); addErrorMessage(account, null, me);
Timber.e("Could not process command '" + processingCommand + "'", me); Timber.e(me, "Could not process command '" + processingCommand + "'");
throw me; throw me;
} finally { } finally {
for (MessagingListener l : getListeners()) { for (MessagingListener l : getListeners()) {
@ -1858,13 +1853,13 @@ public class MessagingController {
if (remoteMessage == null) { if (remoteMessage == null) {
if (localMessage.isSet(Flag.X_REMOTE_COPY_STARTED)) { if (localMessage.isSet(Flag.X_REMOTE_COPY_STARTED)) {
w("Local message with uid " + localMessage.getUid() + Timber.w("Local message with uid " + localMessage.getUid() +
" has flag " + X_REMOTE_COPY_STARTED + " has flag " + X_REMOTE_COPY_STARTED +
" already set, checking for remote message with " + " already set, checking for remote message with " +
" same message id"); " same message id");
String rUid = remoteFolder.getUidFromMessageId(localMessage); String rUid = remoteFolder.getUidFromMessageId(localMessage);
if (rUid != null) { if (rUid != null) {
w("Local message has flag " + X_REMOTE_COPY_STARTED + Timber.w("Local message has flag " + X_REMOTE_COPY_STARTED +
" already set, and there is a remote message with uid " + " already set, and there is a remote message with uid " +
rUid + ", assuming message was already copied and aborting this copy"); rUid + ", assuming message was already copied and aborting this copy");
@ -1876,7 +1871,7 @@ public class MessagingController {
} }
return; return;
} else { } else {
w("No remote message with message-id found, proceeding with append"); Timber.w("No remote message with message-id found, proceeding with append");
} }
} }
@ -2031,7 +2026,7 @@ public class MessagingController {
} }
if (!isCopy && Expunge.EXPUNGE_IMMEDIATELY == account.getExpungePolicy()) { if (!isCopy && Expunge.EXPUNGE_IMMEDIATELY == account.getExpungePolicy()) {
if (K9.DEBUG) { if (K9.DEBUG) {
i("processingPendingMoveOrCopy expunging folder " + account.getDescription() + ":" + Timber.i("processingPendingMoveOrCopy expunging folder " + account.getDescription() + ":" +
srcFolder); srcFolder);
} }
@ -2197,7 +2192,7 @@ public class MessagingController {
remoteFolder.setFlags(Collections.singleton(Flag.SEEN), true); remoteFolder.setFlags(Collections.singleton(Flag.SEEN), true);
remoteFolder.close(); remoteFolder.close();
} catch (UnsupportedOperationException uoe) { } catch (UnsupportedOperationException uoe) {
Timber.w("Could not mark all server-side as read because store doesn't support operation", uoe); Timber.w(uoe, "Could not mark all server-side as read because store doesn't support operation");
} finally { } finally {
closeFolder(localFolder); closeFolder(localFolder);
closeFolder(remoteFolder); closeFolder(remoteFolder);
@ -2231,7 +2226,7 @@ public class MessagingController {
addErrorMessage(account, subject, baos.toString()); addErrorMessage(account, subject, baos.toString());
} catch (Throwable it) { } catch (Throwable it) {
Timber.e("Could not save error message to " + account.getErrorFolderName(), it); Timber.e(it, "Could not save error message to " + account.getErrorFolderName());
} }
} }
@ -2268,7 +2263,7 @@ public class MessagingController {
localFolder.clearMessagesOlderThan(nowTime - (15 * 60 * 1000)); localFolder.clearMessagesOlderThan(nowTime - (15 * 60 * 1000));
} catch (Throwable it) { } catch (Throwable it) {
Timber.e("Could not save error message to " + account.getErrorFolderName(), it); Timber.e(it, "Could not save error message to " + account.getErrorFolderName());
} finally { } finally {
loopCatch.set(false); loopCatch.set(false);
} }
@ -2278,7 +2273,7 @@ public class MessagingController {
public void markAllMessagesRead(final Account account, final String folder) { public void markAllMessagesRead(final Account account, final String folder) {
if (K9.DEBUG) { if (K9.DEBUG) {
i("Marking all messages in " + account.getDescription() + ":" + folder + " as read"); Timber.i("Marking all messages in " + account.getDescription() + ":" + folder + " as read");
} }
PendingCommand command = PendingMarkAllAsRead.create(folder); PendingCommand command = PendingMarkAllAsRead.create(folder);
queuePendingCommand(account, command); queuePendingCommand(account, command);
@ -2318,7 +2313,7 @@ public class MessagingController {
try { try {
localStore = account.getLocalStore(); localStore = account.getLocalStore();
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Couldn't get LocalStore instance", e); Timber.e(e, "Couldn't get LocalStore instance");
return; return;
} }
@ -2333,7 +2328,7 @@ public class MessagingController {
removeFlagFromCache(account, ids, flag); removeFlagFromCache(account, ids, flag);
} }
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Couldn't set flags in local database", e); Timber.e(e, "Couldn't set flags in local database");
} }
// Read folder name and UID of messages from the database // Read folder name and UID of messages from the database
@ -2341,7 +2336,7 @@ public class MessagingController {
try { try {
folderMap = localStore.getFoldersAndUids(ids, threadedList); folderMap = localStore.getFoldersAndUids(ids, threadedList);
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Couldn't get folder name and UID of messages", e); Timber.e(e, "Couldn't get folder name and UID of messages");
return; return;
} }
@ -2357,7 +2352,7 @@ public class MessagingController {
l.folderStatusChanged(account, folderName, unreadMessageCount); l.folderStatusChanged(account, folderName, unreadMessageCount);
} }
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.w("Couldn't get unread count for folder: " + folderName, e); Timber.w(e, "Couldn't get unread count for folder: " + folderName);
} }
// The error folder is always a local folder // The error folder is always a local folder
@ -2477,11 +2472,11 @@ public class MessagingController {
public void clearAllPending(final Account account) { public void clearAllPending(final Account account) {
try { try {
w("Clearing pending commands!"); Timber.w("Clearing pending commands!");
LocalStore localStore = account.getLocalStore(); LocalStore localStore = account.getLocalStore();
localStore.removePendingCommands(); localStore.removePendingCommands();
} catch (MessagingException me) { } catch (MessagingException me) {
Timber.e("Unable to clear pending command", me); Timber.e(me, "Unable to clear pending command");
addErrorMessage(account, null, me); addErrorMessage(account, null, me);
} }
} }
@ -2519,7 +2514,7 @@ public class MessagingController {
LocalMessage message = localFolder.getMessage(uid); LocalMessage message = localFolder.getMessage(uid);
if (uid.startsWith(K9.LOCAL_UID_PREFIX)) { if (uid.startsWith(K9.LOCAL_UID_PREFIX)) {
w("Message has local UID so cannot download fully."); Timber.w("Message has local UID so cannot download fully.");
// ASH move toast // ASH move toast
android.widget.Toast.makeText(context, android.widget.Toast.makeText(context,
"Message has local UID so cannot download fully", "Message has local UID so cannot download fully",
@ -2655,7 +2650,7 @@ public class MessagingController {
} }
} catch (MessagingException me) { } catch (MessagingException me) {
if (K9.DEBUG) { if (K9.DEBUG) {
Timber.v("Exception loading attachment", me); Timber.v(me, "Exception loading attachment");
} }
for (MessagingListener l : getListeners(listener)) { for (MessagingListener l : getListeners(listener)) {
@ -2761,7 +2756,7 @@ public class MessagingController {
return true; return true;
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("Exception while checking for unsent messages", e); Timber.e(e, "Exception while checking for unsent messages");
} finally { } finally {
closeFolder(localFolder); closeFolder(localFolder);
} }
@ -2782,7 +2777,7 @@ public class MessagingController {
account.getOutboxFolderName()); account.getOutboxFolderName());
if (!localFolder.exists()) { if (!localFolder.exists()) {
if (K9.DEBUG) { if (K9.DEBUG) {
v("Outbox does not exist"); Timber.v("Outbox does not exist");
} }
return; return;
} }
@ -2806,7 +2801,7 @@ public class MessagingController {
fp.add(FetchProfile.Item.BODY); fp.add(FetchProfile.Item.BODY);
if (K9.DEBUG) { if (K9.DEBUG) {
i("Scanning folder '" + account.getOutboxFolderName() Timber.i("Scanning folder '" + account.getOutboxFolderName()
+ "' (" + localFolder.getId() + ") for messages to send"); + "' (" + localFolder.getId() + ") for messages to send");
} }
@ -2824,11 +2819,11 @@ public class MessagingController {
count = oldCount; count = oldCount;
} }
if (K9.DEBUG) { if (K9.DEBUG) {
i("Send count for message " + message.getUid() + " is " + count.get()); Timber.i("Send count for message " + message.getUid() + " is " + count.get());
} }
if (count.incrementAndGet() > K9.MAX_SEND_ATTEMPTS) { if (count.incrementAndGet() > K9.MAX_SEND_ATTEMPTS) {
e("Send count for message " + message.getUid() + " can't be delivered after " Timber.e("Send count for message " + message.getUid() + " can't be delivered after "
+ MAX_SEND_ATTEMPTS + " attempts. Giving up until the user restarts the device"); + MAX_SEND_ATTEMPTS + " attempts. Giving up until the user restarts the device");
notificationController.showSendFailedNotification(account, notificationController.showSendFailedNotification(account,
new MessagingException(message.getSubject())); new MessagingException(message.getSubject()));
@ -2838,14 +2833,14 @@ public class MessagingController {
localFolder.fetch(Collections.singletonList(message), fp, null); localFolder.fetch(Collections.singletonList(message), fp, null);
try { try {
if (message.getHeader(K9.IDENTITY_HEADER).length > 0) { if (message.getHeader(K9.IDENTITY_HEADER).length > 0) {
v("The user has set the Outbox and Drafts folder to the same thing. " + Timber.v("The user has set the Outbox and Drafts folder to the same thing. " +
"This message appears to be a draft, so K-9 will not send it"); "This message appears to be a draft, so K-9 will not send it");
continue; continue;
} }
message.setFlag(Flag.X_SEND_IN_PROGRESS, true); message.setFlag(Flag.X_SEND_IN_PROGRESS, true);
if (K9.DEBUG) { if (K9.DEBUG) {
i("Sending message with UID " + message.getUid()); Timber.i("Sending message with UID " + message.getUid());
} }
transport.sendMessage(message); transport.sendMessage(message);
message.setFlag(Flag.X_SEND_IN_PROGRESS, false); message.setFlag(Flag.X_SEND_IN_PROGRESS, false);
@ -2881,7 +2876,7 @@ public class MessagingController {
} catch (Exception e) { } catch (Exception e) {
lastFailure = e; lastFailure = e;
wasPermanentFailure = false; wasPermanentFailure = false;
Timber.e("Failed to fetch message for sending", e); Timber.e(e, "Failed to fetch message for sending");
addErrorMessage(account, "Failed to fetch message for sending", e); addErrorMessage(account, "Failed to fetch message for sending", e);
notifySynchronizeMailboxFailed(account, localFolder, e); notifySynchronizeMailboxFailed(account, localFolder, e);
} }
@ -2899,11 +2894,11 @@ public class MessagingController {
} }
} }
} catch (UnavailableStorageException e) { } catch (UnavailableStorageException e) {
i("Failed to send pending messages because storage is not available - trying again later."); Timber.i("Failed to send pending messages because storage is not available - trying again later.");
throw new UnavailableAccountException(e); throw new UnavailableAccountException(e);
} catch (Exception e) { } catch (Exception e) {
if (K9.DEBUG) { if (K9.DEBUG) {
Timber.v("Failed to send pending messages", e); Timber.v(e, "Failed to send pending messages");
} }
for (MessagingListener l : getListeners()) { for (MessagingListener l : getListeners()) {
l.sendPendingMessagesFailed(account); l.sendPendingMessagesFailed(account);
@ -2922,20 +2917,20 @@ public class MessagingController {
LocalFolder localFolder, LocalMessage message) throws MessagingException { LocalFolder localFolder, LocalMessage message) throws MessagingException {
if (!account.hasSentFolder()) { if (!account.hasSentFolder()) {
if (K9.DEBUG) { if (K9.DEBUG) {
i("Account does not have a sent mail folder; deleting sent message"); Timber.i("Account does not have a sent mail folder; deleting sent message");
} }
message.setFlag(Flag.DELETED, true); message.setFlag(Flag.DELETED, true);
} else { } else {
LocalFolder localSentFolder = localStore.getFolder(account.getSentFolderName()); LocalFolder localSentFolder = localStore.getFolder(account.getSentFolderName());
if (K9.DEBUG) { if (K9.DEBUG) {
i("Moving sent message to folder '" + account.getSentFolderName() + "' (" + Timber.i("Moving sent message to folder '" + account.getSentFolderName() + "' (" +
localSentFolder.getId() + ") "); localSentFolder.getId() + ") ");
} }
localFolder.moveMessages(Collections.singletonList(message), localSentFolder); localFolder.moveMessages(Collections.singletonList(message), localSentFolder);
if (K9.DEBUG) { if (K9.DEBUG) {
i("Moved sent message to folder '" + account.getSentFolderName() + "' (" + Timber.i("Moved sent message to folder '" + account.getSentFolderName() + "' (" +
localSentFolder.getId() + ") "); localSentFolder.getId() + ") ");
} }
@ -2948,7 +2943,7 @@ public class MessagingController {
private void handleSendFailure(Account account, Store localStore, Folder localFolder, Message message, private void handleSendFailure(Account account, Store localStore, Folder localFolder, Message message,
Exception exception, boolean permanentFailure) throws MessagingException { Exception exception, boolean permanentFailure) throws MessagingException {
Timber.e("Failed to send message", exception); Timber.e(exception, "Failed to send message");
if (permanentFailure) { if (permanentFailure) {
moveMessageToDraftsFolder(account, localFolder, localStore, message); moveMessageToDraftsFolder(account, localFolder, localStore, message);
@ -2984,8 +2979,8 @@ public class MessagingController {
AccountStats stats = account.getStats(context); AccountStats stats = account.getStats(context);
listener.accountStatusChanged(account, stats); listener.accountStatusChanged(account, stats);
} catch (MessagingException me) { } catch (MessagingException me) {
Timber.e("Count not get unread count for account " + Timber.e(me, "Count not get unread count for account " +
account.getDescription(), me); account.getDescription());
} }
} }
@ -3082,7 +3077,7 @@ public class MessagingController {
Folder localFolder = account.getLocalStore().getFolder(folderName); Folder localFolder = account.getLocalStore().getFolder(folderName);
unreadMessageCount = localFolder.getUnreadMessageCount(); unreadMessageCount = localFolder.getUnreadMessageCount();
} catch (MessagingException me) { } catch (MessagingException me) {
Timber.e("Count not get unread count for account " + account.getDescription(), me); Timber.e(me, "Count not get unread count for account " + account.getDescription());
} }
l.folderStatusChanged(account, folderName, unreadMessageCount); l.folderStatusChanged(account, folderName, unreadMessageCount);
} }
@ -3108,7 +3103,7 @@ public class MessagingController {
return localStore.isMoveCapable() && remoteStore.isMoveCapable(); return localStore.isMoveCapable() && remoteStore.isMoveCapable();
} catch (MessagingException me) { } catch (MessagingException me) {
Timber.e("Exception while ascertaining move capability", me); Timber.e(me, "Exception while ascertaining move capability");
return false; return false;
} }
} }
@ -3119,7 +3114,7 @@ public class MessagingController {
Store remoteStore = account.getRemoteStore(); Store remoteStore = account.getRemoteStore();
return localStore.isCopyCapable() && remoteStore.isCopyCapable(); return localStore.isCopyCapable() && remoteStore.isCopyCapable();
} catch (MessagingException me) { } catch (MessagingException me) {
Timber.e("Exception while ascertaining copy capability", me); Timber.e(me, "Exception while ascertaining copy capability");
return false; return false;
} }
} }
@ -3248,7 +3243,7 @@ public class MessagingController {
} }
if (K9.DEBUG) { if (K9.DEBUG) {
i("moveOrCopyMessageSynchronous: source folder = " + srcFolder Timber.i("moveOrCopyMessageSynchronous: source folder = " + srcFolder
+ ", " + messages.size() + " messages, " + ", destination folder = " + destFolder + + ", " + messages.size() + " messages, " + ", destination folder = " + destFolder +
", isCopy = " + isCopy); ", isCopy = " + isCopy);
} }
@ -3299,7 +3294,7 @@ public class MessagingController {
processPendingCommands(account); processPendingCommands(account);
} catch (UnavailableStorageException e) { } catch (UnavailableStorageException e) {
i("Failed to move/copy message because storage is not available - trying again later."); Timber.i("Failed to move/copy message because storage is not available - trying again later.");
throw new UnavailableAccountException(e); throw new UnavailableAccountException(e);
} catch (MessagingException me) { } catch (MessagingException me) {
addErrorMessage(account, null, me); addErrorMessage(account, null, me);
@ -3360,7 +3355,7 @@ public class MessagingController {
deleteMessagesSynchronous(account, folderName, deleteMessagesSynchronous(account, folderName,
messagesToDelete, null); messagesToDelete, null);
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Something went wrong while deleting threads", e); Timber.e(e, "Something went wrong while deleting threads");
} }
} }
@ -3511,7 +3506,7 @@ public class MessagingController {
unsuppressMessages(account, messages); unsuppressMessages(account, messages);
} catch (UnavailableStorageException e) { } catch (UnavailableStorageException e) {
i("Failed to delete message because storage is not available - trying again later."); Timber.i("Failed to delete message because storage is not available - trying again later.");
throw new UnavailableAccountException(e); throw new UnavailableAccountException(e);
} catch (MessagingException me) { } catch (MessagingException me) {
addErrorMessage(account, null, me); addErrorMessage(account, null, me);
@ -3582,10 +3577,10 @@ public class MessagingController {
processPendingCommands(account); processPendingCommands(account);
} }
} catch (UnavailableStorageException e) { } catch (UnavailableStorageException e) {
i("Failed to empty trash because storage is not available - trying again later."); Timber.i("Failed to empty trash because storage is not available - trying again later.");
throw new UnavailableAccountException(e); throw new UnavailableAccountException(e);
} catch (Exception e) { } catch (Exception e) {
Timber.e("emptyTrash failed", e); Timber.e(e, "emptyTrash failed");
addErrorMessage(account, null, e); addErrorMessage(account, null, e);
} finally { } finally {
closeFolder(localFolder); closeFolder(localFolder);
@ -3611,10 +3606,10 @@ public class MessagingController {
localFolder.open(Folder.OPEN_MODE_RW); localFolder.open(Folder.OPEN_MODE_RW);
localFolder.clearAllMessages(); localFolder.clearAllMessages();
} catch (UnavailableStorageException e) { } catch (UnavailableStorageException e) {
i("Failed to clear folder because storage is not available - trying again later."); Timber.i("Failed to clear folder because storage is not available - trying again later.");
throw new UnavailableAccountException(e); throw new UnavailableAccountException(e);
} catch (Exception e) { } catch (Exception e) {
Timber.e("clearFolder failed", e); Timber.e(e, "clearFolder failed");
addErrorMessage(account, null, e); addErrorMessage(account, null, e);
} finally { } finally {
closeFolder(localFolder); closeFolder(localFolder);
@ -3716,7 +3711,7 @@ public class MessagingController {
try { try {
if (K9.DEBUG) { if (K9.DEBUG) {
i("Starting mail check"); Timber.i("Starting mail check");
} }
Preferences prefs = Preferences.getPreferences(context); Preferences prefs = Preferences.getPreferences(context);
@ -3733,7 +3728,7 @@ public class MessagingController {
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("Unable to synchronize mail", e); Timber.e(e, "Unable to synchronize mail");
addErrorMessage(account, null, e); addErrorMessage(account, null, e);
} }
putBackground("finalize sync", null, new Runnable() { putBackground("finalize sync", null, new Runnable() {
@ -3741,7 +3736,7 @@ public class MessagingController {
public void run() { public void run() {
if (K9.DEBUG) { if (K9.DEBUG) {
i("Finished mail sync"); Timber.i("Finished mail sync");
} }
if (wakeLock != null) { if (wakeLock != null) {
@ -3764,20 +3759,20 @@ public class MessagingController {
final MessagingListener listener) { final MessagingListener listener) {
if (!account.isAvailable(context)) { if (!account.isAvailable(context)) {
if (K9.DEBUG) { if (K9.DEBUG) {
i("Skipping synchronizing unavailable account " + account.getDescription()); Timber.i("Skipping synchronizing unavailable account " + account.getDescription());
} }
return; return;
} }
final long accountInterval = account.getAutomaticCheckIntervalMinutes() * 60 * 1000; final long accountInterval = account.getAutomaticCheckIntervalMinutes() * 60 * 1000;
if (!ignoreLastCheckedTime && accountInterval <= 0) { if (!ignoreLastCheckedTime && accountInterval <= 0) {
if (K9.DEBUG) { if (K9.DEBUG) {
i("Skipping synchronizing account " + account.getDescription()); Timber.i("Skipping synchronizing account " + account.getDescription());
} }
return; return;
} }
if (K9.DEBUG) { if (K9.DEBUG) {
i("Synchronizing account " + account.getDescription()); Timber.i("Synchronizing account " + account.getDescription());
} }
account.setRingNotified(false); account.setRingNotified(false);
@ -3821,14 +3816,14 @@ public class MessagingController {
synchronizeFolder(account, folder, ignoreLastCheckedTime, accountInterval, listener); synchronizeFolder(account, folder, ignoreLastCheckedTime, accountInterval, listener);
} }
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Unable to synchronize account " + account.getName(), e); Timber.e(e, "Unable to synchronize account " + account.getName());
addErrorMessage(account, null, e); addErrorMessage(account, null, e);
} finally { } finally {
putBackground("clear notification flag for " + account.getDescription(), null, new Runnable() { putBackground("clear notification flag for " + account.getDescription(), null, new Runnable() {
@Override @Override
public void run() { public void run() {
if (K9.DEBUG) { if (K9.DEBUG) {
v("Clearing notification flag for " + account.getDescription()); Timber.v("Clearing notification flag for " + account.getDescription());
} }
account.setRingNotified(false); account.setRingNotified(false);
try { try {
@ -3837,7 +3832,7 @@ public class MessagingController {
notificationController.clearNewMailNotifications(account); notificationController.clearNewMailNotifications(account);
} }
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Unable to getUnreadMessageCount for account: " + account, e); Timber.e(e, "Unable to getUnreadMessageCount for account: " + account);
} }
} }
} }
@ -3857,14 +3852,14 @@ public class MessagingController {
if (K9.DEBUG) { if (K9.DEBUG) {
v("Folder " + folder.getName() + " was last synced @ " + Timber.v("Folder " + folder.getName() + " was last synced @ " +
new Date(folder.getLastChecked())); new Date(folder.getLastChecked()));
} }
if (!ignoreLastCheckedTime && folder.getLastChecked() > if (!ignoreLastCheckedTime && folder.getLastChecked() >
(System.currentTimeMillis() - accountInterval)) { (System.currentTimeMillis() - accountInterval)) {
if (K9.DEBUG) { if (K9.DEBUG) {
v("Not syncing folder " + folder.getName() Timber.v("Not syncing folder " + folder.getName()
+ ", previously synced @ " + new Date(folder.getLastChecked()) + ", previously synced @ " + new Date(folder.getLastChecked())
+ " which would be too recent for the account period"); + " which would be too recent for the account period");
} }
@ -3885,7 +3880,7 @@ public class MessagingController {
if (!ignoreLastCheckedTime && tLocalFolder.getLastChecked() > if (!ignoreLastCheckedTime && tLocalFolder.getLastChecked() >
(System.currentTimeMillis() - accountInterval)) { (System.currentTimeMillis() - accountInterval)) {
if (K9.DEBUG) { if (K9.DEBUG) {
v("Not running Command for folder " + folder.getName() Timber.v("Not running Command for folder " + folder.getName()
+ ", previously synced @ " + new Date(folder.getLastChecked()) + ", previously synced @ " + new Date(folder.getLastChecked())
+ " which would be too recent for the account period"); + " which would be too recent for the account period");
} }
@ -3899,8 +3894,8 @@ public class MessagingController {
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("Exception while processing folder " + Timber.e(e, "Exception while processing folder " +
account.getDescription() + ":" + folder.getName(), e); account.getDescription() + ":" + folder.getName());
addErrorMessage(account, null, e); addErrorMessage(account, null, e);
} finally { } finally {
closeFolder(tLocalFolder); closeFolder(tLocalFolder);
@ -3938,10 +3933,10 @@ public class MessagingController {
l.accountSizeChanged(account, oldSize, newSize); l.accountSizeChanged(account, oldSize, newSize);
} }
} catch (UnavailableStorageException e) { } catch (UnavailableStorageException e) {
i("Failed to compact account because storage is not available - trying again later."); Timber.i("Failed to compact account because storage is not available - trying again later.");
throw new UnavailableAccountException(e); throw new UnavailableAccountException(e);
} catch (Exception e) { } catch (Exception e) {
Timber.e("Failed to compact account " + account.getDescription(), e); Timber.e(e, "Failed to compact account " + account.getDescription());
} }
} }
}); });
@ -3966,10 +3961,10 @@ public class MessagingController {
l.accountStatusChanged(account, stats); l.accountStatusChanged(account, stats);
} }
} catch (UnavailableStorageException e) { } catch (UnavailableStorageException e) {
i("Failed to clear account because storage is not available - trying again later."); Timber.i("Failed to clear account because storage is not available - trying again later.");
throw new UnavailableAccountException(e); throw new UnavailableAccountException(e);
} catch (Exception e) { } catch (Exception e) {
Timber.e("Failed to clear account " + account.getDescription(), e); Timber.e(e, "Failed to clear account " + account.getDescription());
} }
} }
}); });
@ -3994,10 +3989,10 @@ public class MessagingController {
l.accountStatusChanged(account, stats); l.accountStatusChanged(account, stats);
} }
} catch (UnavailableStorageException e) { } catch (UnavailableStorageException e) {
i("Failed to recreate an account because storage is not available - trying again later."); Timber.i("Failed to recreate an account because storage is not available - trying again later.");
throw new UnavailableAccountException(e); throw new UnavailableAccountException(e);
} catch (Exception e) { } catch (Exception e) {
Timber.e("Failed to recreate account " + account.getDescription(), e); Timber.e(e, "Failed to recreate account " + account.getDescription());
} }
} }
}); });
@ -4121,7 +4116,7 @@ public class MessagingController {
} }
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Unable to save message as draft.", e); Timber.e(e, "Unable to save message as draft.");
addErrorMessage(account, null, e); addErrorMessage(account, null, e);
} }
return localMessage; return localMessage;
@ -4132,7 +4127,7 @@ public class MessagingController {
if (message instanceof LocalMessage) { if (message instanceof LocalMessage) {
id = message.getId(); id = message.getId();
} else { } else {
w("MessagingController.getId() called without a LocalMessage"); Timber.w("MessagingController.getId() called without a LocalMessage");
id = INVALID_MESSAGE_ID; id = INVALID_MESSAGE_ID;
} }
@ -4248,7 +4243,7 @@ public class MessagingController {
continue; continue;
} }
if (K9.DEBUG) { if (K9.DEBUG) {
i("Starting pusher for " + account.getDescription() + ":" + folder.getName()); Timber.i("Starting pusher for " + account.getDescription() + ":" + folder.getName());
} }
names.add(folder.getName()); names.add(folder.getName());
@ -4260,7 +4255,7 @@ public class MessagingController {
if (names.size() > maxPushFolders) { if (names.size() > maxPushFolders) {
if (K9.DEBUG) { if (K9.DEBUG) {
i("Count of folders to push for account " + account.getDescription() + " is " + Timber.i("Count of folders to push for account " + account.getDescription() + " is " +
names.size() names.size()
+ ", greater than limit of " + maxPushFolders + ", truncating"); + ", greater than limit of " + maxPushFolders + ", truncating");
} }
@ -4272,7 +4267,7 @@ public class MessagingController {
Store store = account.getRemoteStore(); Store store = account.getRemoteStore();
if (!store.isPushCapable()) { if (!store.isPushCapable()) {
if (K9.DEBUG) { if (K9.DEBUG) {
i("Account " + account.getDescription() + " is not push capable, skipping"); Timber.i("Account " + account.getDescription() + " is not push capable, skipping");
} }
return false; return false;
@ -4285,27 +4280,27 @@ public class MessagingController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("Could not get remote store", e); Timber.e(e, "Could not get remote store");
return false; return false;
} }
return true; return true;
} else { } else {
if (K9.DEBUG) { if (K9.DEBUG) {
i("No folders are configured for pushing in account " + account.getDescription()); Timber.i("No folders are configured for pushing in account " + account.getDescription());
} }
return false; return false;
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("Got exception while setting up pushing", e); Timber.e(e, "Got exception while setting up pushing");
} }
return false; return false;
} }
public void stopAllPushing() { public void stopAllPushing() {
if (K9.DEBUG) { if (K9.DEBUG) {
i("Stopping all pushers"); Timber.i("Stopping all pushers");
} }
Iterator<Pusher> iter = pushers.values().iterator(); Iterator<Pusher> iter = pushers.values().iterator();
@ -4319,7 +4314,7 @@ public class MessagingController {
public void messagesArrived(final Account account, final Folder remoteFolder, final List<Message> messages, public void messagesArrived(final Account account, final Folder remoteFolder, final List<Message> messages,
final boolean flagSyncOnly) { final boolean flagSyncOnly) {
if (K9.DEBUG) { if (K9.DEBUG) {
i("Got new pushed email messages for account " + account.getDescription() Timber.i("Got new pushed email messages for account " + account.getDescription()
+ ", folder " + remoteFolder.getName()); + ", folder " + remoteFolder.getName());
} }
@ -4343,7 +4338,7 @@ public class MessagingController {
localFolder.setStatus(null); localFolder.setStatus(null);
if (K9.DEBUG) { if (K9.DEBUG) {
i("messagesArrived newCount = " + newCount + ", unread count = " + unreadMessageCount); Timber.i("messagesArrived newCount = " + newCount + ", unread count = " + unreadMessageCount);
} }
if (unreadMessageCount == 0) { if (unreadMessageCount == 0) {
@ -4360,7 +4355,7 @@ public class MessagingController {
try { try {
localFolder.setStatus(errorMessage); localFolder.setStatus(errorMessage);
} catch (Exception se) { } catch (Exception se) {
Timber.e("Unable to set failed status on localFolder", se); Timber.e(se, "Unable to set failed status on localFolder");
} }
for (MessagingListener l : getListeners()) { for (MessagingListener l : getListeners()) {
l.synchronizeMailboxFailed(account, remoteFolder.getName(), errorMessage); l.synchronizeMailboxFailed(account, remoteFolder.getName(), errorMessage);
@ -4376,10 +4371,10 @@ public class MessagingController {
try { try {
latch.await(); latch.await();
} catch (Exception e) { } catch (Exception e) {
Timber.e("Interrupted while awaiting latch release", e); Timber.e(e, "Interrupted while awaiting latch release");
} }
if (K9.DEBUG) { if (K9.DEBUG) {
i("MessagingController.messagesArrivedLatch released"); Timber.i("MessagingController.messagesArrivedLatch released");
} }
} }
@ -4466,7 +4461,7 @@ public class MessagingController {
List<LocalMessage> localMessages = messageFolder.getMessagesByReference(messageReferences); List<LocalMessage> localMessages = messageFolder.getMessagesByReference(messageReferences);
actor.act(account, messageFolder, localMessages); actor.act(account, messageFolder, localMessages);
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Error loading account?!", e); Timber.e(e, "Error loading account?!");
} }
} }

View file

@ -64,7 +64,7 @@ public class MessagingControllerPushReceiver implements PushReceiver {
if (K9.DEBUG) if (K9.DEBUG)
Timber.v("syncFolder(" + folder.getName() + ") got latch release"); Timber.v("syncFolder(" + folder.getName() + ") got latch release");
} catch (Exception e) { } catch (Exception e) {
Timber.e("Interrupted while awaiting latch release", e); Timber.e(e, "Interrupted while awaiting latch release");
} }
} }
@ -96,8 +96,8 @@ public class MessagingControllerPushReceiver implements PushReceiver {
localFolder.open(Folder.OPEN_MODE_RW); localFolder.open(Folder.OPEN_MODE_RW);
return localFolder.getPushState(); return localFolder.getPushState();
} catch (Exception e) { } catch (Exception e) {
Timber.e("Unable to get push state from account " + account.getDescription() Timber.e(e, "Unable to get push state from account " + account.getDescription()
+ ", folder " + folderName, e); + ", folder " + folderName);
return null; return null;
} finally { } finally {
if (localFolder != null) { if (localFolder != null) {

View file

@ -1164,7 +1164,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
LocalFolder firstMsgFolder = getFolder(firstMsg.getFolderName(), account); LocalFolder firstMsgFolder = getFolder(firstMsg.getFolderName(), account);
firstMsgFolder.setLastSelectedFolderName(destFolderName); firstMsgFolder.setLastSelectedFolderName(destFolderName);
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Error getting folder for setLastSelectedFolderName()", e); Timber.e(e, "Error getting folder for setLastSelectedFolderName()");
} }
} }
@ -2828,7 +2828,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
mListener.remoteSearchFinished(mCurrentFolder.name, 0, searchAccount.getRemoteSearchNumResults(), null); mListener.remoteSearchFinished(mCurrentFolder.name, 0, searchAccount.getRemoteSearchNumResults(), null);
} catch (Exception e) { } catch (Exception e) {
// Since the user is going back, log and squash any exceptions. // Since the user is going back, log and squash any exceptions.
Timber.e("Could not abort remote search before going back", e); Timber.e(e, "Could not abort remote search before going back");
} }
} }
super.onStop(); super.onStop();

View file

@ -265,7 +265,7 @@ public class Contacts {
Uri person = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, contactId); Uri person = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, contactId);
return Uri.withAppendedPath(person, ContactsContract.Contacts.Photo.CONTENT_DIRECTORY); return Uri.withAppendedPath(person, ContactsContract.Contacts.Photo.CONTENT_DIRECTORY);
} catch (Exception e) { } catch (Exception e) {
Timber.e("Couldn't fetch photo for contact with email " + address, e); Timber.e(e, "Couldn't fetch photo for contact with email " + address);
return null; return null;
} }
} }

View file

@ -82,7 +82,7 @@ public class FileHelper {
} }
} }
} catch (Exception e) { } catch (Exception e) {
Timber.d("Unable to touch file: " + file.getAbsolutePath(), e); Timber.d(e, "Unable to touch file: " + file.getAbsolutePath());
} }
} }
@ -150,7 +150,7 @@ public class FileHelper {
} }
return true; return true;
} catch (Exception e) { } catch (Exception e) {
Timber.w("cannot move " + from.getAbsolutePath() + " to " + to.getAbsolutePath(), e); Timber.w(e, "cannot move " + from.getAbsolutePath() + " to " + to.getAbsolutePath());
return false; return false;
} }
} }

View file

@ -72,7 +72,7 @@ public class AttachmentResolver {
result.put(contentId, attachmentInfo.internalUri); result.put(contentId, attachmentInfo.internalUri);
} }
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Error extracting attachment info", e); Timber.e(e, "Error extracting attachment info");
} }
} }
} }

View file

@ -612,7 +612,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
prefHolder.displayClass = FolderClass.valueOf(storage.getString(id + ".displayMode", prefHolder.displayClass = FolderClass.valueOf(storage.getString(id + ".displayMode",
prefHolder.displayClass.name())); prefHolder.displayClass.name()));
} catch (Exception e) { } catch (Exception e) {
Timber.e("Unable to load displayMode for " + getName(), e); Timber.e(e, "Unable to load displayMode for " + getName());
} }
if (prefHolder.displayClass == FolderClass.NONE) { if (prefHolder.displayClass == FolderClass.NONE) {
prefHolder.displayClass = FolderClass.NO_CLASS; prefHolder.displayClass = FolderClass.NO_CLASS;
@ -622,7 +622,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
prefHolder.syncClass = FolderClass.valueOf(storage.getString(id + ".syncMode", prefHolder.syncClass = FolderClass.valueOf(storage.getString(id + ".syncMode",
prefHolder.syncClass.name())); prefHolder.syncClass.name()));
} catch (Exception e) { } catch (Exception e) {
Timber.e("Unable to load syncMode for " + getName(), e); Timber.e(e, "Unable to load syncMode for " + getName());
} }
if (prefHolder.syncClass == FolderClass.NONE) { if (prefHolder.syncClass == FolderClass.NONE) {
@ -633,7 +633,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
prefHolder.notifyClass = FolderClass.valueOf(storage.getString(id + ".notifyMode", prefHolder.notifyClass = FolderClass.valueOf(storage.getString(id + ".notifyMode",
prefHolder.notifyClass.name())); prefHolder.notifyClass.name()));
} catch (Exception e) { } catch (Exception e) {
Timber.e("Unable to load notifyMode for " + getName(), e); Timber.e(e, "Unable to load notifyMode for " + getName());
} }
if (prefHolder.notifyClass == FolderClass.NONE) { if (prefHolder.notifyClass == FolderClass.NONE) {
prefHolder.notifyClass = FolderClass.INHERITED; prefHolder.notifyClass = FolderClass.INHERITED;
@ -643,7 +643,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
prefHolder.pushClass = FolderClass.valueOf(storage.getString(id + ".pushMode", prefHolder.pushClass = FolderClass.valueOf(storage.getString(id + ".pushMode",
prefHolder.pushClass.name())); prefHolder.pushClass.name()));
} catch (Exception e) { } catch (Exception e) {
Timber.e("Unable to load pushMode for " + getName(), e); Timber.e(e, "Unable to load pushMode for " + getName());
} }
if (prefHolder.pushClass == FolderClass.NONE) { if (prefHolder.pushClass == FolderClass.NONE) {
prefHolder.pushClass = FolderClass.INHERITED; prefHolder.pushClass = FolderClass.INHERITED;
@ -1661,7 +1661,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
try { try {
updateOrInsertMessagePart(db, new ContentValues(), part, messagePartId); updateOrInsertMessagePart(db, new ContentValues(), part, messagePartId);
} catch (Exception e) { } catch (Exception e) {
Timber.e("Error writing message part", e); Timber.e(e, "Error writing message part");
} }
return null; return null;
@ -1709,7 +1709,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
try { try {
message.setFlags(flags, value); message.setFlags(flags, value);
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Something went wrong while setting flag", e); Timber.e(e, "Something went wrong while setting flag");
} }
} }
@ -1925,7 +1925,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
return cursor.getInt(0); return cursor.getInt(0);
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("Unable to updateLastUid: ", e); Timber.e(e, "Unable to updateLastUid: ");
} finally { } finally {
Utility.closeQuietly(cursor); Utility.closeQuietly(cursor);
} }
@ -1950,7 +1950,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
return cursor.getLong(0); return cursor.getLong(0);
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("Unable to fetch oldest message date: ", e); Timber.e(e, "Unable to fetch oldest message date: ");
} finally { } finally {
Utility.closeQuietly(cursor); Utility.closeQuietly(cursor);
} }

View file

@ -249,7 +249,7 @@ public class LocalStore extends Store implements Serializable {
try { try {
removeInstance(account); removeInstance(account);
} catch (Exception e) { } catch (Exception e) {
Timber.e("Failed to reset local store for account " + account.getUuid(), e); Timber.e(e, "Failed to reset local store for account " + account.getUuid());
} }
} }
@ -631,7 +631,7 @@ public class LocalStore extends Store implements Serializable {
i++; i++;
} }
} catch (Exception e) { } catch (Exception e) {
Timber.d("Got an exception", e); Timber.d(e, "Got an exception");
} finally { } finally {
Utility.closeQuietly(cursor); Utility.closeQuietly(cursor);
} }

View file

@ -88,7 +88,7 @@ public class LockableDatabase {
unlockWrite(); unlockWrite();
} }
} catch (UnavailableStorageException e) { } catch (UnavailableStorageException e) {
Timber.w("Unable to writelock on unmount", e); Timber.w(e, "Unable to writelock on unmount");
} }
} }
@ -106,7 +106,7 @@ public class LockableDatabase {
try { try {
openOrCreateDataspace(); openOrCreateDataspace();
} catch (UnavailableStorageException e) { } catch (UnavailableStorageException e) {
Timber.e("Unable to open DB on mount", e); Timber.e(e, "Unable to open DB on mount");
} }
} }
} }
@ -326,7 +326,7 @@ public class LockableDatabase {
try { try {
mDb.close(); mDb.close();
} catch (Exception e) { } catch (Exception e) {
Timber.i("Unable to close DB on local store migration", e); Timber.i(e, "Unable to close DB on local store migration");
} }
final StorageManager storageManager = getStorageManager(); final StorageManager storageManager = getStorageManager();
@ -378,7 +378,7 @@ public class LockableDatabase {
doOpenOrCreateDb(databaseFile); doOpenOrCreateDb(databaseFile);
} catch (SQLiteException e) { } catch (SQLiteException e) {
// TODO handle this error in a better way! // TODO handle this error in a better way!
Timber.w("Unable to open DB " + databaseFile + " - removing file and retrying", e); Timber.w(e, "Unable to open DB " + databaseFile + " - removing file and retrying");
if (databaseFile.exists() && !databaseFile.delete()) { if (databaseFile.exists() && !databaseFile.delete()) {
Timber.d("Failed to remove " + databaseFile + " that couldn't be opened"); Timber.d("Failed to remove " + databaseFile + " that couldn't be opened");
} }
@ -493,7 +493,7 @@ public class LockableDatabase {
try { try {
deleteDatabase(storageManager.getDatabase(uUid, mStorageProviderId)); deleteDatabase(storageManager.getDatabase(uUid, mStorageProviderId));
} catch (Exception e) { } catch (Exception e) {
Timber.i("LockableDatabase: delete(): Unable to delete backing DB file", e); Timber.i(e, "LockableDatabase: delete(): Unable to delete backing DB file");
} }
if (recreate) { if (recreate) {

View file

@ -204,7 +204,7 @@ public class StorageManager {
return isMountPoint(root) return isMountPoint(root)
&& Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()); && Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState());
} catch (IOException e) { } catch (IOException e) {
Timber.w("Specified root isn't ready: " + mRoot, e); Timber.w(e, "Specified root isn't ready: " + mRoot);
return false; return false;
} }
} }
@ -641,7 +641,7 @@ public class StorageManager {
try { try {
listener.onUnmount(provider.getId()); listener.onUnmount(provider.getId());
} catch (Exception e) { } catch (Exception e) {
Timber.w("Error while notifying StorageListener", e); Timber.w(e, "Error while notifying StorageListener");
} }
} }
final SynchronizationAid sync = mProviderLocks.get(resolveProvider(path)); final SynchronizationAid sync = mProviderLocks.get(resolveProvider(path));
@ -682,7 +682,7 @@ public class StorageManager {
try { try {
listener.onMount(provider.getId()); listener.onMount(provider.getId());
} catch (Exception e) { } catch (Exception e) {
Timber.w("Error while notifying StorageListener", e); Timber.w(e, "Error while notifying StorageListener");
} }
} }

View file

@ -44,7 +44,7 @@ class StoreSchemaDefinition implements LockableDatabase.SchemaDefinition {
throw new Error("Exception while upgrading database", e); throw new Error("Exception while upgrading database", e);
} }
Timber.e("Exception while upgrading database. Resetting the DB to v0", e); Timber.e(e, "Exception while upgrading database. Resetting the DB to v0");
db.setVersion(0); db.setVersion(0);
upgradeDatabase(db); upgradeDatabase(db);
} }

View file

@ -13,7 +13,7 @@ class MigrationTo35 {
try { try {
db.execSQL("update messages set flags = replace(flags, 'X_NO_SEEN_INFO', 'X_BAD_FLAG')"); db.execSQL("update messages set flags = replace(flags, 'X_NO_SEEN_INFO', 'X_BAD_FLAG')");
} catch (SQLiteException e) { } catch (SQLiteException e) {
Timber.e("Unable to get rid of obsolete flag X_NO_SEEN_INFO", e); Timber.e(e, "Unable to get rid of obsolete flag X_NO_SEEN_INFO");
} }
} }
} }

View file

@ -38,11 +38,11 @@ class MigrationTo41 {
String name = cursor.getString(1); String name = cursor.getString(1);
update41Metadata(db, migrationsHelper, id, name); update41Metadata(db, migrationsHelper, id, name);
} catch (Exception e) { } catch (Exception e) {
Timber.e(" error trying to ugpgrade a folder class", e); Timber.e(e, " error trying to ugpgrade a folder class");
} }
} }
} catch (SQLiteException e) { } catch (SQLiteException e) {
Timber.e("Exception while upgrading database to v41. folder classes may have vanished", e); Timber.e(e, "Exception while upgrading database to v41. folder classes may have vanished");
} finally { } finally {
Utility.closeQuietly(cursor); Utility.closeQuietly(cursor);
} }
@ -73,7 +73,7 @@ class MigrationTo41 {
inTopGroup = storage.getBoolean(accountUuid + "." + name + ".inTopGroup", inTopGroup); inTopGroup = storage.getBoolean(accountUuid + "." + name + ".inTopGroup", inTopGroup);
integrate = storage.getBoolean(accountUuid + "." + name + ".integrate", integrate); integrate = storage.getBoolean(accountUuid + "." + name + ".integrate", integrate);
} catch (Exception e) { } catch (Exception e) {
Timber.e(" Throwing away an error while trying to upgrade folder metadata", e); Timber.e(e, " Throwing away an error while trying to upgrade folder metadata");
} }
if (displayClass == Folder.FolderClass.NONE) { if (displayClass == Folder.FolderClass.NONE) {

View file

@ -35,7 +35,7 @@ class MigrationTo42 {
Timber.i("Putting folder preferences for " + folders.size() + Timber.i("Putting folder preferences for " + folders.size() +
" folders back into Preferences took " + (endTime - startTime) + " ms"); " folders back into Preferences took " + (endTime - startTime) + " ms");
} catch (Exception e) { } catch (Exception e) {
Timber.e("Could not replace Preferences in upgrade from DB_VERSION 41", e); Timber.e(e, "Could not replace Preferences in upgrade from DB_VERSION 41");
} }
} }
} }

View file

@ -56,7 +56,7 @@ class MigrationTo43 {
obsoleteOutbox.delete(true); obsoleteOutbox.delete(true);
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("Error trying to fix the outbox folders", e); Timber.e(e, "Error trying to fix the outbox folders");
} }
} }
} }

View file

@ -124,7 +124,7 @@ class MigrationTo51 {
cv.put("attachment_count", attachmentCount); cv.put("attachment_count", attachmentCount);
db.update("messages", cv, "id = ?", new String[] { Long.toString(messageId) }); db.update("messages", cv, "id = ?", new String[] { Long.toString(messageId) });
} catch (IOException e) { } catch (IOException e) {
Timber.e("error inserting into database", e); Timber.e(e, "error inserting into database");
} }
} }

View file

@ -50,7 +50,7 @@ class MigrationTo55 {
} }
} }
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("error indexing fulltext - skipping rest, fts index is incomplete!", e); Timber.e(e, "error indexing fulltext - skipping rest, fts index is incomplete!");
} }
} }
} }

View file

@ -99,7 +99,7 @@ public class AttachmentInfoExtractor {
uri = DecryptedFileProvider.getUriForProvidedFile( uri = DecryptedFileProvider.getUriForProvidedFile(
context, file, decryptedTempFileBody.getEncoding(), mimeType); context, file, decryptedTempFileBody.getEncoding(), mimeType);
} catch (IOException e) { } catch (IOException e) {
Timber.e("Decrypted temp file (no longer?) exists!", e); Timber.e(e, "Decrypted temp file (no longer?) exists!");
uri = null; uri = null;
} }
return uri; return uri;

View file

@ -193,7 +193,7 @@ public class SettingsImporter {
} }
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("Exception while importing global settings", e); Timber.e(e, "Exception while importing global settings");
} }
} }
@ -244,12 +244,12 @@ public class SettingsImporter {
} }
} catch (InvalidSettingValueException e) { } catch (InvalidSettingValueException e) {
if (K9.DEBUG) { if (K9.DEBUG) {
Timber.e("Encountered invalid setting while " + Timber.e(e, "Encountered invalid setting while " +
"importing account \"" + account.name + "\"", e); "importing account \"" + account.name + "\"");
} }
erroneousAccounts.add(new AccountDescription(account.name, account.uuid)); erroneousAccounts.add(new AccountDescription(account.name, account.uuid));
} catch (Exception e) { } catch (Exception e) {
Timber.e("Exception while importing account \"" + account.name + "\"", e); Timber.e(e, "Exception while importing account \"" + account.name + "\"");
erroneousAccounts.add(new AccountDescription(account.name, account.uuid)); erroneousAccounts.add(new AccountDescription(account.name, account.uuid));
} }
} else { } else {

View file

@ -119,7 +119,7 @@ public class Storage {
writeValue(mDb, uuid + ".storeUri", newStoreUriStr); writeValue(mDb, uuid + ".storeUri", newStoreUriStr);
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("ooops", e); Timber.e(e, "ooops");
} }
} }
} }
@ -294,7 +294,7 @@ public class Storage {
try { try {
return Integer.parseInt(val); return Integer.parseInt(val);
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
Timber.e("Could not parse int", nfe); Timber.e(nfe, "Could not parse int");
return defValue; return defValue;
} }
} }
@ -307,7 +307,7 @@ public class Storage {
try { try {
return Long.parseLong(val); return Long.parseLong(val);
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
Timber.e("Could not parse long", nfe); Timber.e(nfe, "Could not parse long");
return defValue; return defValue;
} }
} }

View file

@ -46,7 +46,7 @@ public class StorageEditor {
commitChanges(); commitChanges();
return true; return true;
} catch (Exception e) { } catch (Exception e) {
Timber.e("Failed to save preferences", e); Timber.e(e, "Failed to save preferences");
return false; return false;
} }
} }

View file

@ -96,7 +96,7 @@ public class AttachmentProvider extends ContentProvider {
final Account account = Preferences.getPreferences(getContext()).getAccount(accountUuid); final Account account = Preferences.getPreferences(getContext()).getAccount(accountUuid);
attachmentInfo = LocalStore.getInstance(account, getContext()).getAttachmentInfo(id); attachmentInfo = LocalStore.getInstance(account, getContext()).getAttachmentInfo(id);
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Unable to retrieve attachment info from local store for ID: " + id, e); Timber.e(e, "Unable to retrieve attachment info from local store for ID: " + id);
return null; return null;
} }
@ -154,7 +154,7 @@ public class AttachmentProvider extends ContentProvider {
type = attachmentInfo.type; type = attachmentInfo.type;
} }
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Unable to retrieve LocalStore for " + account, e); Timber.e(e, "Unable to retrieve LocalStore for " + account);
type = MimeUtility.DEFAULT_ATTACHMENT_MIME_TYPE; type = MimeUtility.DEFAULT_ATTACHMENT_MIME_TYPE;
} }
@ -171,10 +171,10 @@ public class AttachmentProvider extends ContentProvider {
} }
return openPgpDataSource.startPumpThread(); return openPgpDataSource.startPumpThread();
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Error getting InputStream for attachment", e); Timber.e(e, "Error getting InputStream for attachment");
return null; return null;
} catch (IOException e) { } catch (IOException e) {
Timber.e("Error creating ParcelFileDescriptor", e); Timber.e(e, "Error creating ParcelFileDescriptor");
return null; return null;
} }
} }

View file

@ -150,7 +150,7 @@ public class MessageProvider extends ContentProvider {
QueryHandler handler = queryHandlers.get(code); QueryHandler handler = queryHandlers.get(code);
cursor = handler.query(uri, projection, selection, selectionArgs, sortOrder); cursor = handler.query(uri, projection, selection, selectionArgs, sortOrder);
} catch (Exception e) { } catch (Exception e) {
Timber.e("Unable to execute query for URI: " + uri, e); Timber.e(e, "Unable to execute query for URI: " + uri);
return null; return null;
} }
@ -1076,7 +1076,7 @@ public class MessageProvider extends ContentProvider {
try { try {
monitored.close(); monitored.close();
} catch (Exception e) { } catch (Exception e) {
Timber.w("Exception while forcibly closing cursor", e); Timber.w(e, "Exception while forcibly closing cursor");
} }
} }
} }
@ -1119,7 +1119,7 @@ public class MessageProvider extends ContentProvider {
try { try {
queue.put(holders); queue.put(holders);
} catch (InterruptedException e) { } catch (InterruptedException e) {
Timber.e("Unable to return message list back to caller", e); Timber.e(e, "Unable to return message list back to caller");
} }
} }
} }

View file

@ -100,7 +100,7 @@ public class UnreadWidgetProvider extends AppWidgetProvider {
} }
} catch (Exception e) { } catch (Exception e) {
if (K9.DEBUG) { if (K9.DEBUG) {
Timber.e("Error getting widget configuration", e); Timber.e(e, "Error getting widget configuration");
} }
} }

View file

@ -202,7 +202,7 @@ public class DatabaseUpgradeService extends Service {
} catch (UnavailableStorageException e) { } catch (UnavailableStorageException e) {
Timber.e("Database unavailable"); Timber.e("Database unavailable");
} catch (Exception e) { } catch (Exception e) {
Timber.e("Error while upgrading database", e); Timber.e(e, "Error while upgrading database");
} }
mProgress++; mProgress++;

View file

@ -309,7 +309,7 @@ public class MailService extends CoreService {
} }
} catch (Exception e) { } catch (Exception e) {
// I once got a NullPointerException deep in new Date(); // I once got a NullPointerException deep in new Date();
Timber.e("Exception while logging", e); Timber.e(e, "Exception while logging");
} }
Intent i = new Intent(this, MailService.class); Intent i = new Intent(this, MailService.class);
@ -414,7 +414,7 @@ public class MailService extends CoreService {
MessagingController.getInstance(getApplication()).sendPendingMessages(null); MessagingController.getInstance(getApplication()).sendPendingMessages(null);
} catch (Exception e) { } catch (Exception e) {
Timber.e("Exception while refreshing pushers", e); Timber.e(e, "Exception while refreshing pushers");
} }
} }

View file

@ -41,7 +41,7 @@ public class RemoteControlReceiver extends CoreReceiver {
bundle.putStringArray(K9_ACCOUNT_UUIDS, uuids); bundle.putStringArray(K9_ACCOUNT_UUIDS, uuids);
bundle.putStringArray(K9_ACCOUNT_DESCRIPTIONS, descriptions); bundle.putStringArray(K9_ACCOUNT_DESCRIPTIONS, descriptions);
} catch (Exception e) { } catch (Exception e) {
Timber.e("Could not handle K9_RESPONSE_INTENT", e); Timber.e(e, "Could not handle K9_RESPONSE_INTENT");
} }
} }

View file

@ -147,7 +147,7 @@ public class RemoteControlService extends CoreService {
BootReceiver.scheduleIntent(RemoteControlService.this, nextTime, i); BootReceiver.scheduleIntent(RemoteControlService.this, nextTime, i);
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("Could not handle K9_SET", e); Timber.e(e, "Could not handle K9_SET");
Toast toast = Toast.makeText(RemoteControlService.this, e.getMessage(), Toast.LENGTH_LONG); Toast toast = Toast.makeText(RemoteControlService.this, e.getMessage(), Toast.LENGTH_LONG);
toast.show(); toast.show();
} }

View file

@ -54,7 +54,7 @@ public class SleepService extends CoreService {
currentThread().getName()); currentThread().getName());
} }
} catch (InterruptedException ie) { } catch (InterruptedException ie) {
Timber.e("SleepService Interrupted while awaiting latch", ie); Timber.e(ie, "SleepService Interrupted while awaiting latch");
} }
SleepDatum releaseDatum = sleepData.remove(id); SleepDatum releaseDatum = sleepData.remove(id);
if (releaseDatum == null) { if (releaseDatum == null) {
@ -69,7 +69,7 @@ public class SleepService extends CoreService {
Timber.d("SleepService reacquireLatch finished for id = " + id + ", thread " + Timber.d("SleepService reacquireLatch finished for id = " + id + ", thread " +
currentThread().getName()); currentThread().getName());
} catch (InterruptedException ie) { } catch (InterruptedException ie) {
Timber.e("SleepService Interrupted while awaiting reacquireLatch", ie); Timber.e(ie, "SleepService Interrupted while awaiting reacquireLatch");
} }
} else { } else {
reacquireWakeLock(releaseDatum); reacquireWakeLock(releaseDatum);

View file

@ -190,7 +190,7 @@ public class QuotedMessagePresenter {
try { try {
cursorPosition = Integer.parseInt(k9identity.get(IdentityField.CURSOR_POSITION)); cursorPosition = Integer.parseInt(k9identity.get(IdentityField.CURSOR_POSITION));
} catch (Exception e) { } catch (Exception e) {
Timber.e("Could not parse cursor position for MessageCompose; continuing.", e); Timber.e(e, "Could not parse cursor position for MessageCompose; continuing.");
} }
} }
@ -298,7 +298,7 @@ public class QuotedMessagePresenter {
try { try {
view.setMessageContentCursorPosition(cursorPosition); view.setMessageContentCursorPosition(cursorPosition);
} catch (Exception e) { } catch (Exception e) {
Timber.e("Could not set cursor position in MessageCompose; ignoring.", e); Timber.e(e, "Could not set cursor position in MessageCompose; ignoring.");
} }
showOrHideQuotedText(quotedMode); showOrHideQuotedText(quotedMode);

View file

@ -226,7 +226,7 @@ public class MessageCryptoHelper {
@Override @Override
public void onError(Exception e) { public void onError(Exception e) {
// TODO actually handle (hand to ui, offer retry?) // TODO actually handle (hand to ui, offer retry?)
Timber.e("Couldn't connect to OpenPgpService", e); Timber.e(e, "Couldn't connect to OpenPgpService");
} }
}); });
openPgpServiceConnection.bindToService(); openPgpServiceConnection.bindToService();
@ -276,9 +276,9 @@ public class MessageCryptoHelper {
throw new IllegalStateException("Unknown crypto part type: " + cryptoPartType); throw new IllegalStateException("Unknown crypto part type: " + cryptoPartType);
} catch (IOException e) { } catch (IOException e) {
Timber.e("IOException", e); Timber.e(e, "IOException");
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("MessagingException", e); Timber.e(e, "MessagingException");
} }
} }
@ -321,7 +321,7 @@ public class MessageCryptoHelper {
TextBody body = new TextBody(new String(decryptedByteOutputStream.toByteArray())); TextBody body = new TextBody(new String(decryptedByteOutputStream.toByteArray()));
return new MimeBodyPart(body, "text/plain"); return new MimeBodyPart(body, "text/plain");
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("MessagingException", e); Timber.e(e, "MessagingException");
} }
return null; return null;
@ -382,7 +382,7 @@ public class MessageCryptoHelper {
Timber.d("signed data type: " + signatureBodyPart.getMimeType()); Timber.d("signed data type: " + signatureBodyPart.getMimeType());
signatureBodyPart.writeTo(os); signatureBodyPart.writeTo(os);
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Exception while writing message to crypto provider", e); Timber.e(e, "Exception while writing message to crypto provider");
} }
} }
}; };
@ -431,7 +431,7 @@ public class MessageCryptoHelper {
throw new IllegalStateException("part to stream must be encrypted or inline!"); throw new IllegalStateException("part to stream must be encrypted or inline!");
} }
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("MessagingException while writing message to crypto provider", e); Timber.e(e, "MessagingException while writing message to crypto provider");
} }
} }
}; };
@ -447,7 +447,7 @@ public class MessageCryptoHelper {
DecryptedFileProvider.getFileFactory(context); DecryptedFileProvider.getFileFactory(context);
return MimePartStreamParser.parse(fileFactory, is); return MimePartStreamParser.parse(fileFactory, is);
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("Something went wrong while parsing the decrypted MIME part", e); Timber.e(e, "Something went wrong while parsing the decrypted MIME part");
//TODO: pass error to main thread and display error message to user //TODO: pass error to main thread and display error message to user
return null; return null;
} }
@ -596,7 +596,7 @@ public class MessageCryptoHelper {
partsToDecryptOrVerify.removeFirst(); partsToDecryptOrVerify.removeFirst();
currentCryptoPart = null; currentCryptoPart = null;
} else { } else {
Timber.e("Got to onCryptoFinished() with no part in processing!", new Throwable()); Timber.e(new Throwable(), "Got to onCryptoFinished() with no part in processing!");
} }
decryptOrVerifyNextPart(); decryptOrVerifyNextPart();
} }
@ -726,7 +726,7 @@ public class MessageCryptoHelper {
} }
return new MimeBodyPart(new TextBody(replacementText), "text/plain"); return new MimeBodyPart(new TextBody(replacementText), "text/plain");
} catch (MessagingException e) { } catch (MessagingException e) {
Timber.e("failed to create clearsigned text replacement part", e); Timber.e(e, "failed to create clearsigned text replacement part");
return NO_REPLACEMENT_PART; return NO_REPLACEMENT_PART;
} }
} }

View file

@ -54,7 +54,7 @@ public class LocalMessageExtractorLoader extends AsyncTaskLoader<MessageViewInfo
try { try {
return messageViewInfoExtractor.extractMessageForView(message, annotations); return messageViewInfoExtractor.extractMessageForView(message, annotations);
} catch (Exception e) { } catch (Exception e) {
Timber.e("Error while decoding message", e); Timber.e(e, "Error while decoding message");
return null; return null;
} }
} }

View file

@ -49,7 +49,7 @@ public class LocalMessageLoader extends AsyncTaskLoader<LocalMessage> {
try { try {
return loadMessageFromDatabase(); return loadMessageFromDatabase();
} catch (Exception e) { } catch (Exception e) {
Timber.e("Error while loading message from database", e); Timber.e(e, "Error while loading message from database");
return null; return null;
} }
} }

View file

@ -181,7 +181,7 @@ public class AttachmentController {
try { try {
intentDataUri = AttachmentTempFileProvider.createTempUriForContentUri(context, attachment.internalUri); intentDataUri = AttachmentTempFileProvider.createTempUriForContentUri(context, attachment.internalUri);
} catch (IOException e) { } catch (IOException e) {
Timber.e("Error creating temp file for attachment!", e); Timber.e(e, "Error creating temp file for attachment!");
return null; return null;
} }
@ -212,7 +212,7 @@ public class AttachmentController {
viewIntent = createViewIntentForFileUri(resolvedIntentInfo.getMimeType(), Uri.fromFile(tempFile)); viewIntent = createViewIntentForFileUri(resolvedIntentInfo.getMimeType(), Uri.fromFile(tempFile));
} catch (IOException e) { } catch (IOException e) {
if (K9.DEBUG) { if (K9.DEBUG) {
Timber.e("Error while saving attachment to use file:// URI with ACTION_VIEW Intent", e); Timber.e(e, "Error while saving attachment to use file:// URI with ACTION_VIEW Intent");
} }
viewIntent = createViewIntentForAttachmentProviderUri(intentDataUri, MimeUtility.DEFAULT_ATTACHMENT_MIME_TYPE); viewIntent = createViewIntentForAttachmentProviderUri(intentDataUri, MimeUtility.DEFAULT_ATTACHMENT_MIME_TYPE);
} }
@ -332,7 +332,7 @@ public class AttachmentController {
try { try {
context.startActivity(intent); context.startActivity(intent);
} catch (ActivityNotFoundException e) { } catch (ActivityNotFoundException e) {
Timber.e("Could not display attachment of type " + attachment.mimeType, e); Timber.e(e, "Could not display attachment of type " + attachment.mimeType);
String message = context.getString(R.string.message_view_no_viewer, attachment.mimeType); String message = context.getString(R.string.message_view_no_viewer, attachment.mimeType);
displayMessageToUser(message); displayMessageToUser(message);
@ -354,7 +354,7 @@ public class AttachmentController {
return saveAttachmentWithUniqueFileName(directory); return saveAttachmentWithUniqueFileName(directory);
} catch (IOException e) { } catch (IOException e) {
if (K9.DEBUG) { if (K9.DEBUG) {
Timber.e("Error saving attachment", e); Timber.e(e, "Error saving attachment");
} }
return null; return null;
} }

View file

@ -57,7 +57,7 @@ class DownloadImageTask extends AsyncTask<String, Void, String> {
return fileName; return fileName;
} catch (Exception e) { } catch (Exception e) {
Timber.e("Error while downloading image", e); Timber.e(e, "Error while downloading image");
return null; return null;
} }
} }

View file

@ -200,7 +200,7 @@ public class MessageCryptoPresenter implements OnCryptoClickListener {
pendingIntent.getIntentSender(), REQUEST_CODE_UNKNOWN_KEY, null, 0, 0, 0); pendingIntent.getIntentSender(), REQUEST_CODE_UNKNOWN_KEY, null, 0, 0, 0);
} }
} catch (IntentSender.SendIntentException e) { } catch (IntentSender.SendIntentException e) {
Timber.e("SendIntentException", e); Timber.e(e, "SendIntentException");
} }
} }
@ -212,7 +212,7 @@ public class MessageCryptoPresenter implements OnCryptoClickListener {
pendingIntent.getIntentSender(), null, null, 0, 0, 0); pendingIntent.getIntentSender(), null, null, 0, 0, 0);
} }
} catch (IntentSender.SendIntentException e) { } catch (IntentSender.SendIntentException e) {
Timber.e("SendIntentException", e); Timber.e(e, "SendIntentException");
} }
} }

View file

@ -789,7 +789,7 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
getActivity().startIntentSenderForResult( getActivity().startIntentSenderForResult(
si, requestCode, fillIntent, flagsMask, flagValues, extraFlags); si, requestCode, fillIntent, flagsMask, flagValues, extraFlags);
} catch (SendIntentException e) { } catch (SendIntentException e) {
Timber.e("Irrecoverable error calling PendingIntent!", e); Timber.e(e, "Irrecoverable error calling PendingIntent!");
} }
} }
}; };

View file

@ -111,7 +111,7 @@ abstract class K9WebViewClient extends WebViewClient {
return new WebResourceResponse(mimeType, null, inputStream); return new WebResourceResponse(mimeType, null, inputStream);
} catch (Exception e) { } catch (Exception e) {
Timber.e("Error while intercepting URI: " + uri, e); Timber.e(e, "Error while intercepting URI: " + uri);
return RESULT_DUMMY_RESPONSE; return RESULT_DUMMY_RESPONSE;
} }
} }

View file

@ -188,7 +188,7 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
final Address senderEmail = mMessage.getFrom()[0]; final Address senderEmail = mMessage.getFrom()[0];
mContacts.createContact(senderEmail); mContacts.createContact(senderEmail);
} catch (Exception e) { } catch (Exception e) {
Timber.e("Couldn't create contact", e); Timber.e(e, "Couldn't create contact");
} }
} }
} }

View file

@ -146,7 +146,7 @@ public class MessageWebView extends RigidWebView {
shiftPressEvent.dispatch(this, null, null); shiftPressEvent.dispatch(this, null, null);
Toast.makeText(getContext() , R.string.select_text_now, Toast.LENGTH_SHORT).show(); Toast.makeText(getContext() , R.string.select_text_now, Toast.LENGTH_SHORT).show();
} catch (Exception e) { } catch (Exception e) {
Timber.e("Exception in emulateShiftHeld()", e); Timber.e(e, "Exception in emulateShiftHeld()");
} }
} }