mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 05:02:26 -05:00
Use Locale.US with toUpperCase() and toLowerCase() where appropriate
This commit is contained in:
parent
9327c86fe7
commit
b69d6cb64c
@ -1931,7 +1931,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
if (message.getSubject() != null) {
|
||||
final String subject = prefix.matcher(message.getSubject()).replaceFirst("");
|
||||
|
||||
if (!subject.toLowerCase().startsWith("re:")) {
|
||||
if (!subject.toLowerCase(Locale.US).startsWith("re:")) {
|
||||
mSubjectView.setText("Re: " + subject);
|
||||
} else {
|
||||
mSubjectView.setText(subject);
|
||||
@ -2028,10 +2028,11 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
}
|
||||
}
|
||||
} else if (ACTION_FORWARD.equals(action)) {
|
||||
if (message.getSubject() != null && !message.getSubject().toLowerCase().startsWith("fwd:")) {
|
||||
mSubjectView.setText("Fwd: " + message.getSubject());
|
||||
String subject = message.getSubject();
|
||||
if (subject != null && !subject.toLowerCase(Locale.US).startsWith("fwd:")) {
|
||||
mSubjectView.setText("Fwd: " + subject);
|
||||
} else {
|
||||
mSubjectView.setText(message.getSubject());
|
||||
mSubjectView.setText(subject);
|
||||
}
|
||||
|
||||
// Quote the message and setup the UI.
|
||||
|
@ -26,6 +26,7 @@ import java.security.cert.CertificateParsingException;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
@ -60,7 +61,7 @@ public class DomainNameChecker {
|
||||
return false;
|
||||
}
|
||||
|
||||
thisDomain = thisDomain.toLowerCase();
|
||||
thisDomain = thisDomain.toLowerCase(Locale.US);
|
||||
if (!isIpAddress(thisDomain)) {
|
||||
return matchDns(certificate, thisDomain);
|
||||
} else {
|
||||
@ -223,7 +224,7 @@ public class DomainNameChecker {
|
||||
return false;
|
||||
}
|
||||
|
||||
thatDomain = thatDomain.toLowerCase();
|
||||
thatDomain = thatDomain.toLowerCase(Locale.US);
|
||||
|
||||
// (a) domain name strings are equal, ignoring case: X matches X
|
||||
boolean rval = thisDomain.equals(thatDomain);
|
||||
|
@ -9,6 +9,7 @@ import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
@ -64,7 +65,7 @@ public class HtmlConverter {
|
||||
|
||||
@Override
|
||||
public void handleTag(boolean opening, String tag, Editable output, XMLReader xmlReader) {
|
||||
tag = tag.toLowerCase();
|
||||
tag = tag.toLowerCase(Locale.US);
|
||||
if (tag.equals("hr") && opening) {
|
||||
// In the case of an <hr>, replace it with a bunch of underscores. This is roughly
|
||||
// the behaviour of Outlook in Rich Text mode.
|
||||
|
@ -131,7 +131,7 @@ public class MimeMessage extends Message {
|
||||
@Override
|
||||
public String getContentType() throws MessagingException {
|
||||
String contentType = getFirstHeader(MimeHeader.HEADER_CONTENT_TYPE);
|
||||
return (contentType == null) ? "text/plain" : contentType.toLowerCase();
|
||||
return (contentType == null) ? "text/plain" : contentType.toLowerCase(Locale.US);
|
||||
}
|
||||
|
||||
public String getDisposition() throws MessagingException {
|
||||
|
@ -12,6 +12,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.IllegalCharsetNameException;
|
||||
@ -940,7 +941,7 @@ public class MimeUtility {
|
||||
return parts[0];
|
||||
}
|
||||
for (String part : parts) {
|
||||
if (part.trim().toLowerCase().startsWith(name.toLowerCase())) {
|
||||
if (part.trim().toLowerCase(Locale.US).startsWith(name.toLowerCase(Locale.US))) {
|
||||
String parameter = part.split("=", 2)[1].trim();
|
||||
if (parameter.startsWith("\"") && parameter.endsWith("\"")) {
|
||||
return parameter.substring(1, parameter.length() - 1);
|
||||
@ -1184,7 +1185,7 @@ public class MimeUtility {
|
||||
String extension = null;
|
||||
|
||||
if (filename != null && filename.lastIndexOf('.') != -1) {
|
||||
extension = filename.substring(filename.lastIndexOf('.') + 1).toLowerCase();
|
||||
extension = filename.substring(filename.lastIndexOf('.') + 1).toLowerCase(Locale.US);
|
||||
returnedType = android.webkit.MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
|
||||
}
|
||||
// If the MIME type set by the user's mailer is application/octet-stream, try to figure
|
||||
@ -1263,7 +1264,7 @@ public class MimeUtility {
|
||||
if (charset == null || "0".equals(charset))
|
||||
charset = "US-ASCII"; // No encoding, so use us-ascii, which is the standard.
|
||||
|
||||
charset = charset.toLowerCase();
|
||||
charset = charset.toLowerCase(Locale.US);
|
||||
if (charset.equals("cp932"))
|
||||
charset = "shift_jis";
|
||||
else if (charset.equals("koi8-u"))
|
||||
|
@ -1461,7 +1461,7 @@ public class ImapStore extends Store {
|
||||
* what type it is and bail out.
|
||||
*/
|
||||
String subType = bs.getString(i);
|
||||
mp.setSubType(subType.toLowerCase());
|
||||
mp.setSubType(subType.toLowerCase(Locale.US));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1490,7 +1490,7 @@ public class ImapStore extends Store {
|
||||
|
||||
String type = bs.getString(0);
|
||||
String subType = bs.getString(1);
|
||||
String mimeType = (type + "/" + subType).toLowerCase();
|
||||
String mimeType = (type + "/" + subType).toLowerCase(Locale.US);
|
||||
|
||||
ImapList bodyParams = null;
|
||||
if (bs.get(2) instanceof ImapList) {
|
||||
@ -1546,7 +1546,7 @@ public class ImapStore extends Store {
|
||||
|
||||
if (bodyDisposition != null && bodyDisposition.size() > 0) {
|
||||
if (!"NIL".equalsIgnoreCase(bodyDisposition.getString(0))) {
|
||||
contentDisposition = bodyDisposition.getString(0).toLowerCase();
|
||||
contentDisposition = bodyDisposition.getString(0).toLowerCase(Locale.US);
|
||||
}
|
||||
|
||||
if ((bodyDisposition.size() > 1)
|
||||
@ -1558,7 +1558,7 @@ public class ImapStore extends Store {
|
||||
*/
|
||||
for (int i = 0, count = bodyDispositionParams.size(); i < count; i += 2) {
|
||||
contentDisposition += String.format(";\n %s=\"%s\"",
|
||||
bodyDispositionParams.getString(i).toLowerCase(),
|
||||
bodyDispositionParams.getString(i).toLowerCase(Locale.US),
|
||||
bodyDispositionParams.getString(i + 1));
|
||||
}
|
||||
}
|
||||
@ -1841,7 +1841,7 @@ public class ImapStore extends Store {
|
||||
// {
|
||||
// Log.v(K9.LOG_TAG, "Saving capability '" + capability + "' for " + getLogId());
|
||||
// }
|
||||
capabilities.add(((String)capability).toUpperCase());
|
||||
capabilities.add(((String)capability).toUpperCase(Locale.US));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2151,7 +2151,7 @@ public class ImapStore extends Store {
|
||||
}
|
||||
|
||||
protected boolean hasCapability(String capability) {
|
||||
return capabilities.contains(capability.toUpperCase());
|
||||
return capabilities.contains(capability.toUpperCase(Locale.US));
|
||||
}
|
||||
|
||||
public boolean isOpen() {
|
||||
|
@ -1601,10 +1601,10 @@ public class LocalStore extends Store implements Serializable {
|
||||
String htmlContent = cursor.getString(0);
|
||||
String textContent = cursor.getString(1);
|
||||
String mimeType = cursor.getString(2);
|
||||
if (mimeType != null && mimeType.toLowerCase().startsWith("multipart/")) {
|
||||
if (mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/")) {
|
||||
// If this is a multipart message, preserve both text
|
||||
// and html parts, as well as the subtype.
|
||||
mp.setSubType(mimeType.toLowerCase().replaceFirst("^multipart/", ""));
|
||||
mp.setSubType(mimeType.toLowerCase(Locale.US).replaceFirst("^multipart/", ""));
|
||||
if (textContent != null) {
|
||||
LocalTextBody body = new LocalTextBody(textContent, htmlContent);
|
||||
MimeBodyPart bp = new MimeBodyPart(body, "text/plain");
|
||||
@ -2144,7 +2144,7 @@ public class LocalStore extends Store implements Serializable {
|
||||
cv.put("sender_list", Address.pack(message.getFrom()));
|
||||
cv.put("date", message.getSentDate() == null
|
||||
? System.currentTimeMillis() : message.getSentDate().getTime());
|
||||
cv.put("flags", Utility.combine(message.getFlags(), ',').toUpperCase());
|
||||
cv.put("flags", Utility.combine(message.getFlags(), ',').toUpperCase(Locale.US));
|
||||
cv.put("deleted", message.isSet(Flag.DELETED) ? 1 : 0);
|
||||
cv.put("folder_id", mFolderId);
|
||||
cv.put("to_list", Address.pack(message.getRecipients(RecipientType.TO)));
|
||||
@ -2263,7 +2263,7 @@ public class LocalStore extends Store implements Serializable {
|
||||
message.getSentDate() == null ? System
|
||||
.currentTimeMillis() : message.getSentDate()
|
||||
.getTime(),
|
||||
Utility.combine(message.getFlags(), ',').toUpperCase(),
|
||||
Utility.combine(message.getFlags(), ',').toUpperCase(Locale.US),
|
||||
mFolderId,
|
||||
Address.pack(message
|
||||
.getRecipients(RecipientType.TO)),
|
||||
@ -2337,7 +2337,7 @@ public class LocalStore extends Store implements Serializable {
|
||||
|
||||
db.execSQL("UPDATE messages " + "SET flags = ? " + " WHERE id = ?",
|
||||
new Object[]
|
||||
{ Utility.combine(appendedFlags.toArray(), ',').toUpperCase(), id });
|
||||
{ Utility.combine(appendedFlags.toArray(), ',').toUpperCase(Locale.US), id });
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -3189,7 +3189,7 @@ public class LocalStore extends Store implements Serializable {
|
||||
* Set the flags on the message.
|
||||
*/
|
||||
db.execSQL("UPDATE messages " + "SET flags = ? " + " WHERE id = ?", new Object[]
|
||||
{ Utility.combine(getFlags(), ',').toUpperCase(), mId });
|
||||
{ Utility.combine(getFlags(), ',').toUpperCase(Locale.US), mId });
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
@ -1590,7 +1590,7 @@ public class WebDavStore extends Store {
|
||||
listener.messageStarted(wdMessage.getUid(), i, count);
|
||||
}
|
||||
|
||||
try {
|
||||
try {
|
||||
wdMessage.setFlagInternal(Flag.SEEN, uidToReadStatus.get(wdMessage.getUid()));
|
||||
} catch (NullPointerException e) {
|
||||
Log.v(K9.LOG_TAG,"Under some weird circumstances, setting the read status when syncing from webdav threw an NPE. Skipping.");
|
||||
@ -1852,7 +1852,7 @@ public class WebDavStore extends Store {
|
||||
public void setUrl(String url) {
|
||||
// TODO: This is a not as ugly hack (ie, it will actually work)
|
||||
// XXX: prevent URLs from getting to us that are broken
|
||||
if (!(url.toLowerCase().contains("http"))) {
|
||||
if (!(url.toLowerCase(Locale.US).contains("http"))) {
|
||||
if (!(url.startsWith("/"))) {
|
||||
url = "/" + url;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user