aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorSam Whited <sam@samwhited.com>2014-11-17 11:53:19 -0500
committerSam Whited <sam@samwhited.com>2014-11-17 12:19:45 -0500
commitb6d89772373284ff70285db1813a45a969ad2151 (patch)
treed9f5480874e81a2b63f6365935a06d11883a864c /src/main/java
parent8865cc406c893dcdb167ab3d89ce5d2c668c2799 (diff)
Use `Locale.US' for string comparisons in search
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Bookmark.java10
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Contact.java10
2 files changed, 14 insertions, 6 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Bookmark.java b/src/main/java/eu/siacs/conversations/entities/Bookmark.java
index 2156ab2ce..91dc25beb 100644
--- a/src/main/java/eu/siacs/conversations/entities/Bookmark.java
+++ b/src/main/java/eu/siacs/conversations/entities/Bookmark.java
@@ -2,6 +2,7 @@ package eu.siacs.conversations.entities;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xml.Element;
@@ -126,13 +127,16 @@ public class Bookmark extends Element implements ListItem {
if (needle == null) {
return true;
}
- needle = needle.toLowerCase();
- return getJid().toString().contains(needle) || getDisplayName().toLowerCase().contains(needle) || matchInTag(needle);
+ needle = needle.toLowerCase(Locale.US);
+ return getJid().toString().contains(needle) ||
+ getDisplayName().toLowerCase(Locale.US).contains(needle) ||
+ matchInTag(needle);
}
private boolean matchInTag(String needle) {
+ needle = needle.toLowerCase(Locale.US);
for (Tag tag : getTags()) {
- if (tag.getName().toLowerCase().contains(needle)) {
+ if (tag.getName().toLowerCase(Locale.US).contains(needle)) {
return true;
}
}
diff --git a/src/main/java/eu/siacs/conversations/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java
index a451c142a..6a6b41d66 100644
--- a/src/main/java/eu/siacs/conversations/entities/Contact.java
+++ b/src/main/java/eu/siacs/conversations/entities/Contact.java
@@ -9,6 +9,7 @@ import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xml.Element;
@@ -148,7 +149,7 @@ public class Contact implements ListItem {
if (needle == null || needle.isEmpty()) {
return true;
}
- needle = needle.toLowerCase().trim();
+ needle = needle.toLowerCase(Locale.US).trim();
String[] parts = needle.split("\\s+");
if (parts.length > 1) {
for(int i = 0; i < parts.length; ++i) {
@@ -158,13 +159,16 @@ public class Contact implements ListItem {
}
return true;
} else {
- return jid.toString().contains(needle) || getDisplayName().toLowerCase().contains(needle) || matchInTag(needle);
+ return jid.toString().contains(needle) ||
+ getDisplayName().toLowerCase(Locale.US).contains(needle) ||
+ matchInTag(needle);
}
}
private boolean matchInTag(String needle) {
+ needle = needle.toLowerCase(Locale.US);
for (Tag tag : getTags()) {
- if (tag.getName().toLowerCase().contains(needle)) {
+ if (tag.getName().toLowerCase(Locale.US).contains(needle)) {
return true;
}
}