diff --git a/src/com/fsck/k9/activity/MessageCompose.java b/src/com/fsck/k9/activity/MessageCompose.java index 8c8eaa0c6..6ea5c91a6 100644 --- a/src/com/fsck/k9/activity/MessageCompose.java +++ b/src/com/fsck/k9/activity/MessageCompose.java @@ -1565,7 +1565,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, * title*2*=%2A%2A%2Afun%2A%2A%2A%20 * title*3="isn't it!" */ - bp.addHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, String.format( + bp.addHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, String.format(Locale.US, "attachment;\r\n filename=\"%s\";\r\n size=%d", attachment.name, attachment.size)); diff --git a/src/com/fsck/k9/activity/setup/AccountSetupBasics.java b/src/com/fsck/k9/activity/setup/AccountSetupBasics.java index 94ba4cf5b..421e56368 100644 --- a/src/com/fsck/k9/activity/setup/AccountSetupBasics.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupBasics.java @@ -24,6 +24,7 @@ import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URISyntaxException; import java.net.URLEncoder; +import java.util.Locale; /** * Prompts the user for the email address and password. @@ -230,7 +231,7 @@ public class AccountSetupBasics extends K9Activity mAccount.setTrashFolderName(getString(R.string.special_mailbox_name_trash)); mAccount.setArchiveFolderName(getString(R.string.special_mailbox_name_archive)); // Yahoo! has a special folder for Spam, called "Bulk Mail". - if (incomingUriTemplate.getHost().toLowerCase().endsWith(".yahoo.com")) { + if (incomingUriTemplate.getHost().toLowerCase(Locale.US).endsWith(".yahoo.com")) { mAccount.setSpamFolderName("Bulk Mail"); } else { mAccount.setSpamFolderName(getString(R.string.special_mailbox_name_spam)); diff --git a/src/com/fsck/k9/fragment/MessageViewFragment.java b/src/com/fsck/k9/fragment/MessageViewFragment.java index 711fcb93d..82dee9c42 100644 --- a/src/com/fsck/k9/fragment/MessageViewFragment.java +++ b/src/com/fsck/k9/fragment/MessageViewFragment.java @@ -2,6 +2,7 @@ package com.fsck.k9.fragment; import java.io.File; import java.util.Collections; +import java.util.Locale; import android.app.Activity; import android.content.Context; @@ -785,7 +786,7 @@ public class MessageViewFragment extends SherlockFragment implements OnClickList } private String getDialogTag(int dialogId) { - return String.format("dialog-%d", dialogId); + return String.format(Locale.US, "dialog-%d", dialogId); } public void zoom(KeyEvent event) { diff --git a/src/com/fsck/k9/helper/Utility.java b/src/com/fsck/k9/helper/Utility.java index f8392413a..5844c701f 100644 --- a/src/com/fsck/k9/helper/Utility.java +++ b/src/com/fsck/k9/helper/Utility.java @@ -26,6 +26,7 @@ import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -498,7 +499,7 @@ public class Utility { format = filename + "-%d"; } for (int i = 2; i < Integer.MAX_VALUE; i++) { - file = new File(directory, String.format(format, i)); + file = new File(directory, String.format(Locale.US, format, i)); if (!file.exists()) { return file; } diff --git a/src/com/fsck/k9/mail/filter/FixedLengthInputStream.java b/src/com/fsck/k9/mail/filter/FixedLengthInputStream.java index 48bf955a2..1125eef7a 100644 --- a/src/com/fsck/k9/mail/filter/FixedLengthInputStream.java +++ b/src/com/fsck/k9/mail/filter/FixedLengthInputStream.java @@ -3,6 +3,7 @@ package com.fsck.k9.mail.filter; import java.io.IOException; import java.io.InputStream; +import java.util.Locale; /** * A filtering InputStream that stops allowing reads after the given length has been read. This @@ -66,6 +67,6 @@ public class FixedLengthInputStream extends InputStream { @Override public String toString() { - return String.format("FixedLengthInputStream(in=%s, length=%d)", mIn.toString(), mLength); + return String.format(Locale.US, "FixedLengthInputStream(in=%s, length=%d)", mIn.toString(), mLength); } } diff --git a/src/com/fsck/k9/mail/filter/PeekableInputStream.java b/src/com/fsck/k9/mail/filter/PeekableInputStream.java index 0175bc4de..5a78c047c 100644 --- a/src/com/fsck/k9/mail/filter/PeekableInputStream.java +++ b/src/com/fsck/k9/mail/filter/PeekableInputStream.java @@ -3,6 +3,7 @@ package com.fsck.k9.mail.filter; import java.io.IOException; import java.io.InputStream; +import java.util.Locale; /** * A filtering InputStream that allows single byte "peeks" without consuming the byte. The @@ -59,7 +60,7 @@ public class PeekableInputStream extends InputStream { @Override public String toString() { - return String.format("PeekableInputStream(in=%s, peeked=%b, peekedByte=%d)", + return String.format(Locale.US, "PeekableInputStream(in=%s, peeked=%b, peekedByte=%d)", mIn.toString(), mPeeked, mPeekedByte); } } diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index f9ecd9761..2363112eb 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -1284,7 +1284,7 @@ public class ImapStore extends Store { int count = 0; int start = 1; - List responses = executeSimpleCommand(String.format("SEARCH %d:* %s", start, criteria)); + List responses = executeSimpleCommand(String.format(Locale.US, "SEARCH %d:* %s", start, criteria)); for (ImapResponse response : responses) { if (ImapResponseParser.equalsIgnoreCase(response.get(0), "SEARCH")) { count += response.size() - 1; @@ -1347,7 +1347,7 @@ public class ImapStore extends Store { throws MessagingException { if (start < 1 || end < 1 || end < start) { throw new MessagingException( - String.format("Invalid message set %d %d", + String.format(Locale.US, "Invalid message set %d %d", start, end)); } final StringBuilder dateSearchString = new StringBuilder(); @@ -1361,7 +1361,7 @@ public class ImapStore extends Store { ImapSearcher searcher = new ImapSearcher() { public List search() throws IOException, MessagingException { - return executeSimpleCommand(String.format("UID SEARCH %d:%d%s%s", start, end, dateSearchString, includeDeleted ? "" : " NOT DELETED")); + return executeSimpleCommand(String.format(Locale.US, "UID SEARCH %d:%d%s%s", start, end, dateSearchString, includeDeleted ? "" : " NOT DELETED")); } }; return search(searcher, listener).toArray(EMPTY_MESSAGE_ARRAY); @@ -1505,7 +1505,7 @@ public class ImapStore extends Store { if (fp.contains(FetchProfile.Item.BODY_SANE)) { // If the user wants to download unlimited-size messages, don't go only for the truncated body if (mAccount.getMaximumAutoDownloadMessageSize() > 0) { - fetchFields.add(String.format("BODY.PEEK[]<0.%d>", mAccount.getMaximumAutoDownloadMessageSize())); + fetchFields.add(String.format(Locale.US, "BODY.PEEK[]<0.%d>", mAccount.getMaximumAutoDownloadMessageSize())); } else { fetchFields.add("BODY.PEEK[]"); } @@ -1961,7 +1961,7 @@ public class ImapStore extends Store { } if (MimeUtility.getHeaderParameter(contentDisposition.toString(), "size") == null) { - contentDisposition.append(String.format(";\r\n size=%d", size)); + contentDisposition.append(String.format(Locale.US, ";\r\n size=%d", size)); } /* @@ -2010,7 +2010,7 @@ public class ImapStore extends Store { Map uidMap = new HashMap(); for (Message message : messages) { mConnection.sendCommand( - String.format("APPEND %s (%s) {%d}", + String.format(Locale.US, "APPEND %s (%s) {%d}", encodeString(encodeFolderName(getPrefixedName())), combineFlags(message.getFlags()), message.calculateSize()), false); @@ -2627,7 +2627,7 @@ public class ImapStore extends Store { if (mSettings.getPathDelimeter() == null) { try { List nameResponses = - executeSimpleCommand(String.format("LIST \"\" \"\"")); + executeSimpleCommand("LIST \"\" \"\""); for (ImapResponse response : nameResponses) { if (ImapResponseParser.equalsIgnoreCase(response.get(0), "LIST")) { mSettings.setPathDelimeter(response.getString(2)); diff --git a/src/com/fsck/k9/mail/store/LocalStore.java b/src/com/fsck/k9/mail/store/LocalStore.java index c1389c4ba..e232c717d 100644 --- a/src/com/fsck/k9/mail/store/LocalStore.java +++ b/src/com/fsck/k9/mail/store/LocalStore.java @@ -223,7 +223,7 @@ public class LocalStore extends Store implements Serializable { } private void upgradeDatabase(final SQLiteDatabase db) { - Log.i(K9.LOG_TAG, String.format("Upgrading database from version %d to version %d", + Log.i(K9.LOG_TAG, String.format(Locale.US, "Upgrading database from version %d to version %d", db.getVersion(), DB_VERSION)); AttachmentProvider.clear(mApplication); @@ -1968,14 +1968,14 @@ public class LocalStore extends Store implements Serializable { type, name)); bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, - String.format("%s;\r\n filename=\"%s\";\r\n size=%d", + String.format(Locale.US, "%s;\r\n filename=\"%s\";\r\n size=%d", contentDisposition, name, // TODO: Should use encoded word defined in RFC 2231. size)); } else { bp.setHeader(MimeHeader.HEADER_CONTENT_TYPE, type); bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, - String.format("%s;\r\n size=%d", + String.format(Locale.US, "%s;\r\n size=%d", contentDisposition, size)); } diff --git a/src/com/fsck/k9/mail/store/Pop3Store.java b/src/com/fsck/k9/mail/store/Pop3Store.java index bdc0ef5bf..ee38e9a08 100644 --- a/src/com/fsck/k9/mail/store/Pop3Store.java +++ b/src/com/fsck/k9/mail/store/Pop3Store.java @@ -26,6 +26,7 @@ import java.util.LinkedList; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; @@ -510,7 +511,7 @@ public class Pop3Store extends Store { public Message[] getMessages(int start, int end, Date earliestDate, MessageRetrievalListener listener) throws MessagingException { if (start < 1 || end < 1 || end < start) { - throw new MessagingException(String.format("Invalid message set %d %d", + throw new MessagingException(String.format(Locale.US, "Invalid message set %d %d", start, end)); } try { @@ -791,7 +792,7 @@ public class Pop3Store extends Store { if (listener != null) { listener.messageStarted(pop3Message.getUid(), i, count); } - String response = executeSimpleCommand(String.format(LIST_COMMAND + " %d", + String response = executeSimpleCommand(String.format(Locale.US, LIST_COMMAND + " %d", mUidToMsgNumMap.get(pop3Message.getUid()))); String[] listParts = response.split(" "); //int msgNum = Integer.parseInt(listParts[1]); @@ -850,7 +851,7 @@ public class Pop3Store extends Store { "Checking to see if the TOP command is supported nevertheless."); } - response = executeSimpleCommand(String.format(TOP_COMMAND + " %d %d", + response = executeSimpleCommand(String.format(Locale.US, TOP_COMMAND + " %d %d", mUidToMsgNumMap.get(message.getUid()), lines)); // TOP command is supported. Remember this for the next time. @@ -872,7 +873,7 @@ public class Pop3Store extends Store { } if (response == null) { - executeSimpleCommand(String.format(RETR_COMMAND + " %d", + executeSimpleCommand(String.format(Locale.US, RETR_COMMAND + " %d", mUidToMsgNumMap.get(message.getUid()))); } diff --git a/src/com/fsck/k9/mail/store/WebDavStore.java b/src/com/fsck/k9/mail/store/WebDavStore.java index 01b45655a..ea33e917f 100644 --- a/src/com/fsck/k9/mail/store/WebDavStore.java +++ b/src/com/fsck/k9/mail/store/WebDavStore.java @@ -1479,7 +1479,7 @@ public class WebDavStore extends Store { end = start + (end - prevStart); if (start < 0 || end < 0 || end < start) { - throw new MessagingException(String.format("Invalid message set %d %d", start, end)); + throw new MessagingException(String.format(Locale.US, "Invalid message set %d %d", start, end)); } if (start == 0 && end < 10) { diff --git a/src/com/fsck/k9/preferences/TimePickerPreference.java b/src/com/fsck/k9/preferences/TimePickerPreference.java index a2d6592b3..2675292e8 100644 --- a/src/com/fsck/k9/preferences/TimePickerPreference.java +++ b/src/com/fsck/k9/preferences/TimePickerPreference.java @@ -4,6 +4,8 @@ package com.fsck.k9.preferences; +import java.util.Locale; + import android.content.Context; import android.preference.DialogPreference; import android.text.format.DateFormat; @@ -94,8 +96,8 @@ public class TimePickerPreference extends DialogPreference implements @Override public void onTimeChanged(final TimePicker view, final int hour, final int minute) { - persistString(String.format("%02d:%02d", hour, minute)); - callChangeListener(String.format("%02d:%02d", hour, minute)); + persistString(String.format(Locale.US, "%02d:%02d", hour, minute)); + callChangeListener(String.format(Locale.US, "%02d:%02d", hour, minute)); } /** @@ -106,8 +108,8 @@ public class TimePickerPreference extends DialogPreference implements protected void onDialogClosed(boolean positiveResult) { if (!positiveResult) { - persistString(String.format("%02d:%02d", originalHour, originalMinute)); - callChangeListener(String.format("%02d:%02d", originalHour, originalMinute)); + persistString(String.format(Locale.US, "%02d:%02d", originalHour, originalMinute)); + callChangeListener(String.format(Locale.US, "%02d:%02d", originalHour, originalMinute)); } super.onDialogClosed(positiveResult); }