Fixing remaining Timber errors in k9mail-library
This commit is contained in:
parent
f7c4b0e7c4
commit
ad1328d775
15 changed files with 54 additions and 56 deletions
|
@ -1048,7 +1048,7 @@ public class MimeUtility {
|
|||
}
|
||||
};
|
||||
} else {
|
||||
Timber.w("Unsupported encoding: " + encoding);
|
||||
Timber.w("Unsupported encoding: %s", encoding);
|
||||
inputStream = rawInputStream;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -20,7 +20,7 @@ public class XOAuth2ChallengeParser {
|
|||
String decodedResponse = Base64.decode(response);
|
||||
|
||||
if (K9MailLib.isDebug()) {
|
||||
Timber.v("Challenge response: " + decodedResponse);
|
||||
Timber.v("Challenge response: %s", decodedResponse);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -30,7 +30,7 @@ public class XOAuth2ChallengeParser {
|
|||
return false;
|
||||
}
|
||||
} catch (JSONException jsonException) {
|
||||
Timber.e("Error decoding JSON response from: " + host + ". Response was: " + decodedResponse);
|
||||
Timber.e("Error decoding JSON response from: %s. Response was: %s", host, decodedResponse);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -55,7 +55,7 @@ public class TracingPowerManager {
|
|||
wakeLock = pm.newWakeLock(flags, tag);
|
||||
id = wakeLockId.getAndIncrement();
|
||||
if (K9MailLib.isDebug()) {
|
||||
Timber.v("TracingWakeLock for tag " + tag + " / id " + id + ": Create");
|
||||
Timber.v("TracingWakeLock for tag %s / id %d: Create", tag, id);
|
||||
}
|
||||
}
|
||||
public void acquire(long timeout) {
|
||||
|
@ -63,7 +63,7 @@ public class TracingPowerManager {
|
|||
wakeLock.acquire(timeout);
|
||||
}
|
||||
if (K9MailLib.isDebug()) {
|
||||
Timber.v("TracingWakeLock for tag " + tag + " / id " + id + " for " + timeout + " ms: acquired");
|
||||
Timber.v("TracingWakeLock for tag %s / id %d for %d ms: acquired", tag, id, timeout);
|
||||
}
|
||||
raiseNotification();
|
||||
if (startTime == null) {
|
||||
|
@ -77,7 +77,8 @@ public class TracingPowerManager {
|
|||
}
|
||||
raiseNotification();
|
||||
if (K9MailLib.isDebug()) {
|
||||
Timber.w("TracingWakeLock for tag " + tag + " / id " + id + ": acquired with no timeout. K-9 Mail should not do this");
|
||||
Timber.w("TracingWakeLock for tag %s / id %d: acquired with no timeout. K-9 Mail should not do this",
|
||||
tag, id);
|
||||
}
|
||||
if (startTime == null) {
|
||||
startTime = SystemClock.elapsedRealtime();
|
||||
|
@ -93,11 +94,12 @@ public class TracingPowerManager {
|
|||
if (startTime != null) {
|
||||
Long endTime = SystemClock.elapsedRealtime();
|
||||
if (K9MailLib.isDebug()) {
|
||||
Timber.v("TracingWakeLock for tag " + tag + " / id " + id + ": releasing after " + (endTime - startTime) + " ms, timeout = " + timeout + " ms");
|
||||
Timber.v("TracingWakeLock for tag %s / id %d: releasing after %d ms, timeout = %d ms",
|
||||
tag, id, endTime - startTime, timeout);
|
||||
}
|
||||
} else {
|
||||
if (K9MailLib.isDebug()) {
|
||||
Timber.v("TracingWakeLock for tag " + tag + " / id " + id + ", timeout = " + timeout + " ms: releasing");
|
||||
Timber.v("TracingWakeLock for tag %s / id %d, timeout = %d ms: releasing", tag, id, timeout);
|
||||
}
|
||||
}
|
||||
cancelNotification();
|
||||
|
@ -127,11 +129,12 @@ public class TracingPowerManager {
|
|||
public void run() {
|
||||
if (startTime != null) {
|
||||
Long endTime = SystemClock.elapsedRealtime();
|
||||
Timber.i("TracingWakeLock for tag " + tag + " / id " + id + ": has been active for "
|
||||
+ (endTime - startTime) + " ms, timeout = " + timeout + " ms");
|
||||
Timber.i("TracingWakeLock for tag %s / id %d: has been active for %d ms, timeout = %d ms",
|
||||
tag, id, endTime - startTime, timeout);
|
||||
|
||||
} else {
|
||||
Timber.i("TracingWakeLock for tag " + tag + " / id " + id + ": still active, timeout = " + timeout + " ms");
|
||||
Timber.i("TracingWakeLock for tag %s / id %d: still active, timeout = %d ms",
|
||||
tag, id, timeout);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -203,10 +203,10 @@ class KeyChainKeyManager extends X509ExtendedKeyManager {
|
|||
return mAlias;
|
||||
}
|
||||
}
|
||||
Timber.w("Client certificate " + mAlias + " not issued by any of the requested issuers");
|
||||
Timber.w("Client certificate %s not issued by any of the requested issuers", mAlias);
|
||||
return null;
|
||||
}
|
||||
Timber.w("Client certificate " + mAlias + " does not match any of the requested key types");
|
||||
Timber.w("Client certificate %s does not match any of the requested key types", mAlias);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class LocalKeyStore {
|
|||
* Keystore.load. Instead, we let it be created anew.
|
||||
*/
|
||||
if (file.exists() && !file.delete()) {
|
||||
Timber.d("Failed to delete empty keystore file: " + file.getAbsolutePath());
|
||||
Timber.d("Failed to delete empty keystore file: %s", file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ public class LocalKeyStore {
|
|||
// Blow away version "0" because certificate aliases have changed.
|
||||
File versionZeroFile = new File(getKeyStoreFilePath(0));
|
||||
if (versionZeroFile.exists() && !versionZeroFile.delete()) {
|
||||
Timber.d("Failed to delete old key-store file: " + versionZeroFile.getAbsolutePath());
|
||||
Timber.d("Failed to delete old key-store file: %s", versionZeroFile.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -555,7 +555,7 @@ class ImapConnection {
|
|||
}
|
||||
|
||||
if (K9MailLib.isDebug()) {
|
||||
Timber.d("useCompression: %b");
|
||||
Timber.d("useCompression: %b", useCompression);
|
||||
}
|
||||
|
||||
return useCompression;
|
||||
|
|
|
@ -481,7 +481,7 @@ class ImapFolderPusher extends ImapFolder {
|
|||
try {
|
||||
Object responseType = response.get(1);
|
||||
if (equalsIgnoreCase(responseType, "FETCH")) {
|
||||
Timber.i("Got FETCH " + response);
|
||||
Timber.i("Got FETCH %s", response);
|
||||
|
||||
long msgSeq = response.getLong(0);
|
||||
|
||||
|
@ -548,7 +548,7 @@ class ImapFolderPusher extends ImapFolder {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Timber.e("Could not handle untagged FETCH for " + getLogId(), e);
|
||||
Timber.e(e, "Could not handle untagged FETCH for %s", getLogId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,12 +86,11 @@ class ImapResponseParser {
|
|||
response = readResponse();
|
||||
|
||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {
|
||||
Timber.v(logId + "<<<" + response);
|
||||
Timber.v("%s<<<%s", logId, response);
|
||||
}
|
||||
|
||||
if (response.getTag() != null && !response.getTag().equalsIgnoreCase(tag)) {
|
||||
Timber.w("After sending tag " + tag + ", got tag response from previous command " + response +
|
||||
" for " + logId);
|
||||
Timber.w("After sending tag %s, got tag response from previous command %s for %s", tag, response, logId);
|
||||
|
||||
Iterator<ImapResponse> responseIterator = responses.iterator();
|
||||
|
||||
|
|
|
@ -180,8 +180,9 @@ public class ImapStore extends RemoteStore {
|
|||
try {
|
||||
decodedFolderName = folderNameCodec.decode(listResponse.getName());
|
||||
} catch (CharacterCodingException e) {
|
||||
Timber.w("Folder name not correctly encoded with the UTF-7 variant " +
|
||||
"as defined by RFC 3501: " + listResponse.getName(), e);
|
||||
Timber.w(e,
|
||||
"Folder name not correctly encoded with the UTF-7 variant as defined by RFC 3501: %s",
|
||||
listResponse.getName());
|
||||
|
||||
//TODO: Use the raw name returned by the server for all commands that require
|
||||
// a folder name. Use the decoded name only for showing it to the user.
|
||||
|
@ -255,8 +256,8 @@ public class ImapStore extends RemoteStore {
|
|||
try {
|
||||
decodedFolderName = folderNameCodec.decode(listResponse.getName());
|
||||
} catch (CharacterCodingException e) {
|
||||
Timber.w("Folder name not correctly encoded with the UTF-7 variant " +
|
||||
"as defined by RFC 3501: " + listResponse.getName(), e);
|
||||
Timber.w(e, "Folder name not correctly encoded with the UTF-7 variant as defined by RFC 3501: %s",
|
||||
listResponse.getName());
|
||||
// We currently just skip folders with malformed names.
|
||||
continue;
|
||||
}
|
||||
|
@ -269,27 +270,27 @@ public class ImapStore extends RemoteStore {
|
|||
if (listResponse.hasAttribute("\\Archive") || listResponse.hasAttribute("\\All")) {
|
||||
mStoreConfig.setArchiveFolderName(decodedFolderName);
|
||||
if (K9MailLib.isDebug()) {
|
||||
Timber.d("Folder auto-configuration detected Archive folder: " + decodedFolderName);
|
||||
Timber.d("Folder auto-configuration detected Archive folder: %s", decodedFolderName);
|
||||
}
|
||||
} else if (listResponse.hasAttribute("\\Drafts")) {
|
||||
mStoreConfig.setDraftsFolderName(decodedFolderName);
|
||||
if (K9MailLib.isDebug()) {
|
||||
Timber.d("Folder auto-configuration detected Drafts folder: " + decodedFolderName);
|
||||
Timber.d("Folder auto-configuration detected Drafts folder: %s", decodedFolderName);
|
||||
}
|
||||
} else if (listResponse.hasAttribute("\\Sent")) {
|
||||
mStoreConfig.setSentFolderName(decodedFolderName);
|
||||
if (K9MailLib.isDebug()) {
|
||||
Timber.d("Folder auto-configuration detected Sent folder: " + decodedFolderName);
|
||||
Timber.d("Folder auto-configuration detected Sent folder: %s", decodedFolderName);
|
||||
}
|
||||
} else if (listResponse.hasAttribute("\\Junk")) {
|
||||
mStoreConfig.setSpamFolderName(decodedFolderName);
|
||||
if (K9MailLib.isDebug()) {
|
||||
Timber.d("Folder auto-configuration detected Spam folder: " + decodedFolderName);
|
||||
Timber.d("Folder auto-configuration detected Spam folder: %s", decodedFolderName);
|
||||
}
|
||||
} else if (listResponse.hasAttribute("\\Trash")) {
|
||||
mStoreConfig.setTrashFolderName(decodedFolderName);
|
||||
if (K9MailLib.isDebug()) {
|
||||
Timber.d("Folder auto-configuration detected Trash folder: " + decodedFolderName);
|
||||
Timber.d("Folder auto-configuration detected Trash folder: %s", decodedFolderName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,12 +100,12 @@ class ImapUtility {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
Timber.d("Invalid range: " + range);
|
||||
Timber.d("Invalid range: %s", range);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
Timber.d("Invalid range value: " + range, e);
|
||||
Timber.d(e, "Invalid range value: %s", range);
|
||||
}
|
||||
|
||||
return list;
|
||||
|
@ -121,7 +121,7 @@ class ImapUtility {
|
|||
// do nothing
|
||||
}
|
||||
|
||||
Timber.d("Invalid UID value: " + number);
|
||||
Timber.d("Invalid UID value: %s", number);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -661,7 +661,7 @@ public class Pop3Store extends RemoteStore {
|
|||
// response = "+OK msgNum msgUid"
|
||||
String[] uidParts = response.split(" +");
|
||||
if (uidParts.length < 3 || !"+OK".equals(uidParts[0])) {
|
||||
Timber.e("ERR response: " + response);
|
||||
Timber.e("ERR response: %s", response);
|
||||
return;
|
||||
}
|
||||
String msgUid = uidParts[2];
|
||||
|
@ -720,7 +720,7 @@ public class Pop3Store extends RemoteStore {
|
|||
for (String uid : uids) {
|
||||
if (mUidToMsgMap.get(uid) == null) {
|
||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
||||
Timber.d("Need to index UID " + uid);
|
||||
Timber.d("Need to index UID %s", uid);
|
||||
}
|
||||
unindexedUids.add(uid);
|
||||
}
|
||||
|
@ -746,7 +746,7 @@ public class Pop3Store extends RemoteStore {
|
|||
String msgUid = uidParts[1];
|
||||
if (unindexedUids.contains(msgUid)) {
|
||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
||||
Timber.d("Got msgNum " + msgNum + " for UID " + msgUid);
|
||||
Timber.d("Got msgNum %d for UID %s", msgNum, msgUid);
|
||||
}
|
||||
|
||||
Pop3Message message = mUidToMsgMap.get(msgUid);
|
||||
|
@ -761,7 +761,7 @@ public class Pop3Store extends RemoteStore {
|
|||
|
||||
private void indexMessage(int msgNum, Pop3Message message) {
|
||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
||||
Timber.d("Adding index for UID " + message.getUid() + " to msgNum " + msgNum);
|
||||
Timber.d("Adding index for UID %s to msgNum %d", message.getUid(), msgNum);
|
||||
}
|
||||
mMsgNumToMsgMap.put(msgNum, message);
|
||||
mUidToMsgMap.put(message.getUid(), message);
|
||||
|
@ -1037,7 +1037,7 @@ public class Pop3Store extends RemoteStore {
|
|||
} while ((d = mIn.read()) != -1);
|
||||
String ret = sb.toString();
|
||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
||||
Timber.d("<<< " + ret);
|
||||
Timber.d("<<< %s", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -1131,10 +1131,9 @@ public class Pop3Store extends RemoteStore {
|
|||
if (command != null) {
|
||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_POP3) {
|
||||
if (sensitive && !K9MailLib.isDebugSensitive()) {
|
||||
Timber.d(">>> "
|
||||
+ "[Command Hidden, Enable Sensitive Debug Logging To Show]");
|
||||
Timber.d(">>> [Command Hidden, Enable Sensitive Debug Logging To Show]");
|
||||
} else {
|
||||
Timber.d(">>> " + command);
|
||||
Timber.d(">>> %s", command);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ class WebDavFolder extends Folder<WebDavMessage> {
|
|||
headers.put("Brief", "t");
|
||||
headers.put("If-Match", "*");
|
||||
String action = (isMove ? "BMOVE" : "BCOPY");
|
||||
Timber.v("Moving " + messages.size() + " messages to " + destFolder.mFolderUrl);
|
||||
Timber.v("Moving %d messages to %s", messages.size(), destFolder.mFolderUrl);
|
||||
|
||||
store.processRequest(mFolderUrl, action, messageBody, headers, false);
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ class WebDavFolder extends Folder<WebDavMessage> {
|
|||
messageCount = dataset.getMessageCount();
|
||||
}
|
||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_WEBDAV) {
|
||||
Timber.v("Counted messages and webdav returned: " + messageCount);
|
||||
Timber.v("Counted messages and webdav returned: %d", messageCount);
|
||||
}
|
||||
|
||||
return messageCount;
|
||||
|
@ -352,16 +352,14 @@ class WebDavFolder extends Folder<WebDavMessage> {
|
|||
*/
|
||||
if (wdMessage.getUrl().equals("")) {
|
||||
wdMessage.setUrl(getMessageUrls(new String[]{wdMessage.getUid()}).get(wdMessage.getUid()));
|
||||
Timber.i("Fetching messages with UID = '" + wdMessage.getUid() + "', URL = '"
|
||||
+ wdMessage.getUrl() + "'");
|
||||
Timber.i("Fetching messages with UID = '%s', URL = '%s'", wdMessage.getUid(), wdMessage.getUrl());
|
||||
if (wdMessage.getUrl().equals("")) {
|
||||
throw new MessagingException("Unable to get URL for message");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Timber.i("Fetching message with UID = '" + wdMessage.getUid() + "', URL = '"
|
||||
+ wdMessage.getUrl() + "'");
|
||||
Timber.i("Fetching message with UID = '%s', URL = '%s'", wdMessage.getUid(), wdMessage.getUrl());
|
||||
HttpGet httpget = new HttpGet(new URI(wdMessage.getUrl()));
|
||||
HttpResponse response;
|
||||
HttpEntity entity;
|
||||
|
@ -559,7 +557,7 @@ class WebDavFolder extends Folder<WebDavMessage> {
|
|||
message.setNewHeaders(envelope);
|
||||
message.setFlagInternal(Flag.SEEN, envelope.getReadStatus());
|
||||
} else {
|
||||
Timber.e("Asked to get metadata for a non-existent message: " + message.getUid());
|
||||
Timber.e("Asked to get metadata for a non-existent message: %s", message.getUid());
|
||||
}
|
||||
|
||||
if (listener != null) {
|
||||
|
@ -673,7 +671,7 @@ class WebDavFolder extends Folder<WebDavMessage> {
|
|||
}
|
||||
messageURL += encodeUtf8(message.getUid() + ":" + System.currentTimeMillis() + ".eml");
|
||||
|
||||
Timber.i("Uploading message as " + messageURL);
|
||||
Timber.i("Uploading message as %s", messageURL);
|
||||
|
||||
store.sendRequest(messageURL, "PUT", bodyEntity, null, true);
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ class WebDavMessage extends MimeMessage {
|
|||
@Override
|
||||
public void delete(String trashFolderName) throws MessagingException {
|
||||
WebDavFolder wdFolder = (WebDavFolder) getFolder();
|
||||
Timber.i("Deleting message by moving to " + trashFolderName);
|
||||
Timber.i("Deleting message by moving to %s", trashFolderName);
|
||||
wdFolder.moveMessages(Collections.singletonList(this), wdFolder.getStore().getFolder(trashFolderName));
|
||||
}
|
||||
|
||||
|
|
|
@ -924,8 +924,7 @@ public class WebDavStore extends RemoteStore {
|
|||
throws MessagingException {
|
||||
DataSet dataset = new DataSet();
|
||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_WEBDAV) {
|
||||
Timber.v("processRequest url = '" + url + "', method = '" + method + "', messageBody = '"
|
||||
+ messageBody + "'");
|
||||
Timber.v("processRequest url = '%s', method = '%s', messageBody = '%s'", url, method, messageBody);
|
||||
}
|
||||
|
||||
if (url == null ||
|
||||
|
@ -957,8 +956,7 @@ public class WebDavStore extends RemoteStore {
|
|||
|
||||
dataset = myHandler.getDataSet();
|
||||
} catch (SAXException se) {
|
||||
Timber.e(se,
|
||||
"SAXException in processRequest()");
|
||||
Timber.e(se, "SAXException in processRequest()");
|
||||
throw new MessagingException("SAXException in processRequest() ", se);
|
||||
} catch (ParserConfigurationException pce) {
|
||||
Timber.e(pce, "ParserConfigurationException in processRequest()");
|
||||
|
|
|
@ -462,7 +462,7 @@ public class SmtpTransport extends Transport {
|
|||
mLargestAcceptableMessage = Integer.parseInt(optionalsizeValue);
|
||||
} catch (NumberFormatException e) {
|
||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_SMTP) {
|
||||
Timber.d("Tried to parse " + optionalsizeValue + " and get an int", e);
|
||||
Timber.d(e, "Tried to parse %s and get an int", optionalsizeValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -627,7 +627,7 @@ public class SmtpTransport extends Transport {
|
|||
}
|
||||
String ret = sb.toString();
|
||||
if (K9MailLib.isDebug() && DEBUG_PROTOCOL_SMTP)
|
||||
Timber.d("SMTP <<< " + ret);
|
||||
Timber.d("SMTP <<< %s", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue