mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 08:12:05 +01:00
Use Locale.US when doing String operations
on machine readable output. The default locale may not provide the wanted mapping. See also http://developer.android.com/reference/java/util/Locale.html#default_locale SMACK-467
This commit is contained in:
parent
94adaf8e50
commit
d8a5610d7b
24 changed files with 67 additions and 39 deletions
|
@ -21,6 +21,7 @@ import java.io.IOException;
|
||||||
import java.io.PipedReader;
|
import java.io.PipedReader;
|
||||||
import java.io.PipedWriter;
|
import java.io.PipedWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
@ -247,7 +248,7 @@ public class BOSHConnection extends XMPPConnection {
|
||||||
throw new AlreadyLoggedInException();
|
throw new AlreadyLoggedInException();
|
||||||
}
|
}
|
||||||
// Do partial version of nameprep on the username.
|
// Do partial version of nameprep on the username.
|
||||||
username = username.toLowerCase().trim();
|
username = username.toLowerCase(Locale.US).trim();
|
||||||
|
|
||||||
String response;
|
String response;
|
||||||
if (saslAuthentication.hasNonAnonymousAuthentication()) {
|
if (saslAuthentication.hasNonAnonymousAuthentication()) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -422,7 +423,7 @@ public class Roster {
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return entries.get(user.toLowerCase());
|
return entries.get(user.toLowerCase(Locale.US));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -633,7 +634,7 @@ public class Roster {
|
||||||
if (!contains(user)) {
|
if (!contains(user)) {
|
||||||
key = StringUtils.parseBareAddress(user);
|
key = StringUtils.parseBareAddress(user);
|
||||||
}
|
}
|
||||||
return key.toLowerCase();
|
return key.toLowerCase(Locale.US);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||||
|
@ -122,7 +123,7 @@ public class RosterGroup {
|
||||||
// Roster entries never include a resource so remove the resource
|
// Roster entries never include a resource so remove the resource
|
||||||
// if it's a part of the XMPP address.
|
// if it's a part of the XMPP address.
|
||||||
user = StringUtils.parseBareAddress(user);
|
user = StringUtils.parseBareAddress(user);
|
||||||
String userLowerCase = user.toLowerCase();
|
String userLowerCase = user.toLowerCase(Locale.US);
|
||||||
synchronized (entries) {
|
synchronized (entries) {
|
||||||
for (RosterEntry entry : entries) {
|
for (RosterEntry entry : entries) {
|
||||||
if (entry.getUser().equals(userLowerCase)) {
|
if (entry.getUser().equals(userLowerCase)) {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smack.filter;
|
package org.jivesoftware.smack.filter;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
@ -86,9 +87,9 @@ public class IQReplyFilter implements PacketFilter {
|
||||||
// in an early stage, i.e. when performing the SASL auth.
|
// in an early stage, i.e. when performing the SASL auth.
|
||||||
local = null;
|
local = null;
|
||||||
} else {
|
} else {
|
||||||
local = conn.getUser().toLowerCase();
|
local = conn.getUser().toLowerCase(Locale.US);
|
||||||
}
|
}
|
||||||
server = conn.getServiceName().toLowerCase();
|
server = conn.getServiceName().toLowerCase(Locale.US);
|
||||||
packetId = iqPacket.getPacketID();
|
packetId = iqPacket.getPacketID();
|
||||||
|
|
||||||
PacketFilter iqFilter = new OrFilter(new IQTypeFilter(IQ.Type.ERROR), new IQTypeFilter(IQ.Type.RESULT));
|
PacketFilter iqFilter = new OrFilter(new IQTypeFilter(IQ.Type.ERROR), new IQTypeFilter(IQ.Type.RESULT));
|
||||||
|
@ -101,7 +102,7 @@ public class IQReplyFilter implements PacketFilter {
|
||||||
fromFilter.addFilter(FromMatchesFilter.createBare(local));
|
fromFilter.addFilter(FromMatchesFilter.createBare(local));
|
||||||
fromFilter.addFilter(FromMatchesFilter.createFull(server));
|
fromFilter.addFilter(FromMatchesFilter.createFull(server));
|
||||||
}
|
}
|
||||||
else if (local != null && to.toLowerCase().equals(StringUtils.parseBareAddress(local))) {
|
else if (local != null && to.toLowerCase(Locale.US).equals(StringUtils.parseBareAddress(local))) {
|
||||||
fromFilter.addFilter(FromMatchesFilter.createFull(null));
|
fromFilter.addFilter(FromMatchesFilter.createFull(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
package org.jivesoftware.smack.packet;
|
package org.jivesoftware.smack.packet;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -202,7 +204,7 @@ public abstract class IQ extends Packet {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
type = type.toLowerCase();
|
type = type.toLowerCase(Locale.US);
|
||||||
if (GET.toString().equals(type)) {
|
if (GET.toString().equals(type)) {
|
||||||
return GET;
|
return GET;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public abstract class Packet {
|
||||||
private static final Logger LOGGER = Logger.getLogger(Packet.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(Packet.class.getName());
|
||||||
|
|
||||||
protected static final String DEFAULT_LANGUAGE =
|
protected static final String DEFAULT_LANGUAGE =
|
||||||
java.util.Locale.getDefault().getLanguage().toLowerCase();
|
java.util.Locale.getDefault().getLanguage().toLowerCase(Locale.US);
|
||||||
|
|
||||||
private static String DEFAULT_XML_NS = null;
|
private static String DEFAULT_XML_NS = null;
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class RosterPacket extends IQ {
|
||||||
* @param name the user's name.
|
* @param name the user's name.
|
||||||
*/
|
*/
|
||||||
public Item(String user, String name) {
|
public Item(String user, String name) {
|
||||||
this.user = user.toLowerCase();
|
this.user = user.toLowerCase(Locale.US);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
itemType = null;
|
itemType = null;
|
||||||
itemStatus = null;
|
itemStatus = null;
|
||||||
|
|
|
@ -20,6 +20,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -157,7 +158,7 @@ public class XMPPError {
|
||||||
buf.append("<error");
|
buf.append("<error");
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
buf.append(" type=\"");
|
buf.append(" type=\"");
|
||||||
buf.append(type.name().toLowerCase());
|
buf.append(type.name().toLowerCase(Locale.US));
|
||||||
buf.append("\"");
|
buf.append("\"");
|
||||||
}
|
}
|
||||||
buf.append(">");
|
buf.append(">");
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
@ -744,11 +745,11 @@ public class PacketParserUtils {
|
||||||
XMPPError.Type errorType = XMPPError.Type.CANCEL;
|
XMPPError.Type errorType = XMPPError.Type.CANCEL;
|
||||||
try {
|
try {
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
errorType = XMPPError.Type.valueOf(type.toUpperCase());
|
errorType = XMPPError.Type.valueOf(type.toUpperCase(Locale.US));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException iae) {
|
catch (IllegalArgumentException iae) {
|
||||||
LOGGER.log(Level.SEVERE, "Could not find error type for " + type.toUpperCase(), iae);
|
LOGGER.log(Level.SEVERE, "Could not find error type for " + type.toUpperCase(Locale.US), iae);
|
||||||
}
|
}
|
||||||
return new XMPPError(errorType, condition, message, extensions);
|
return new XMPPError(errorType, condition, message, extensions);
|
||||||
}
|
}
|
||||||
|
|
|
@ -802,7 +802,7 @@ public class PacketParserUtilsTest {
|
||||||
Locale[] availableLocales = Locale.getAvailableLocales();
|
Locale[] availableLocales = Locale.getAvailableLocales();
|
||||||
for (int i = 0; i < availableLocales.length; i++) {
|
for (int i = 0; i < availableLocales.length; i++) {
|
||||||
if (availableLocales[i] != Locale.getDefault()) {
|
if (availableLocales[i] != Locale.getDefault()) {
|
||||||
otherLanguage = availableLocales[i].getLanguage().toLowerCase();
|
otherLanguage = availableLocales[i].getLanguage().toLowerCase(Locale.US);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.bytestreams.ibb.packet;
|
package org.jivesoftware.smackx.bytestreams.ibb.packet;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager;
|
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager;
|
||||||
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType;
|
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType;
|
||||||
|
@ -120,7 +122,7 @@ public class Open extends IQ {
|
||||||
buf.append(sessionID);
|
buf.append(sessionID);
|
||||||
buf.append("\" ");
|
buf.append("\" ");
|
||||||
buf.append("stanza=\"");
|
buf.append("stanza=\"");
|
||||||
buf.append(stanza.toString().toLowerCase());
|
buf.append(stanza.toString().toLowerCase(Locale.US));
|
||||||
buf.append("\"");
|
buf.append("\"");
|
||||||
buf.append("/>");
|
buf.append("/>");
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.bytestreams.ibb.provider;
|
package org.jivesoftware.smackx.bytestreams.ibb.provider;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.provider.IQProvider;
|
import org.jivesoftware.smack.provider.IQProvider;
|
||||||
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType;
|
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType;
|
||||||
|
@ -39,7 +41,7 @@ public class OpenIQProvider implements IQProvider {
|
||||||
stanza = StanzaType.IQ;
|
stanza = StanzaType.IQ;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
stanza = StanzaType.valueOf(stanzaValue.toUpperCase());
|
stanza = StanzaType.valueOf(stanzaValue.toUpperCase(Locale.US));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Open(sessionID, blockSize, stanza);
|
return new Open(sessionID, blockSize, stanza);
|
||||||
|
|
|
@ -54,6 +54,7 @@ import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
@ -278,7 +279,7 @@ public class EntityCapsManager extends Manager {
|
||||||
CapsExtension ext = (CapsExtension) packet.getExtension(EntityCapsManager.ELEMENT,
|
CapsExtension ext = (CapsExtension) packet.getExtension(EntityCapsManager.ELEMENT,
|
||||||
EntityCapsManager.NAMESPACE);
|
EntityCapsManager.NAMESPACE);
|
||||||
|
|
||||||
String hash = ext.getHash().toLowerCase();
|
String hash = ext.getHash().toLowerCase(Locale.US);
|
||||||
if (!SUPPORTED_HASHES.containsKey(hash))
|
if (!SUPPORTED_HASHES.containsKey(hash))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -560,7 +561,7 @@ public class EntityCapsManager extends Manager {
|
||||||
* supported
|
* supported
|
||||||
*/
|
*/
|
||||||
protected static String generateVerificationString(DiscoverInfo discoverInfo, String hash) {
|
protected static String generateVerificationString(DiscoverInfo discoverInfo, String hash) {
|
||||||
MessageDigest md = SUPPORTED_HASHES.get(hash.toLowerCase());
|
MessageDigest md = SUPPORTED_HASHES.get(hash.toLowerCase(Locale.US));
|
||||||
if (md == null)
|
if (md == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
@ -169,7 +170,7 @@ public class MultiUserChat {
|
||||||
*/
|
*/
|
||||||
public MultiUserChat(XMPPConnection connection, String room) {
|
public MultiUserChat(XMPPConnection connection, String room) {
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
this.room = room.toLowerCase();
|
this.room = room.toLowerCase(Locale.US);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.jivesoftware.smack.packet.Packet;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
@ -150,21 +151,21 @@ class RoomListenerMultiplexor extends AbstractConnectionListener {
|
||||||
if (from == null) {
|
if (from == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return roomAddressTable.containsKey(StringUtils.parseBareAddress(from).toLowerCase());
|
return roomAddressTable.containsKey(StringUtils.parseBareAddress(from).toLowerCase(Locale.US));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRoom(String address) {
|
public void addRoom(String address) {
|
||||||
if (address == null) {
|
if (address == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
roomAddressTable.put(address.toLowerCase(), address);
|
roomAddressTable.put(address.toLowerCase(Locale.US), address);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeRoom(String address) {
|
public void removeRoom(String address) {
|
||||||
if (address == null) {
|
if (address == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
roomAddressTable.remove(address.toLowerCase());
|
roomAddressTable.remove(address.toLowerCase(Locale.US));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +192,7 @@ class RoomListenerMultiplexor extends AbstractConnectionListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
PacketMultiplexListener listener =
|
PacketMultiplexListener listener =
|
||||||
roomListenersByAddress.get(StringUtils.parseBareAddress(from).toLowerCase());
|
roomListenersByAddress.get(StringUtils.parseBareAddress(from).toLowerCase(Locale.US));
|
||||||
|
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.processPacket(p);
|
listener.processPacket(p);
|
||||||
|
@ -202,14 +203,14 @@ class RoomListenerMultiplexor extends AbstractConnectionListener {
|
||||||
if (address == null) {
|
if (address == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
roomListenersByAddress.put(address.toLowerCase(), listener);
|
roomListenersByAddress.put(address.toLowerCase(Locale.US), listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeRoom(String address) {
|
public void removeRoom(String address) {
|
||||||
if (address == null) {
|
if (address == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
roomListenersByAddress.remove(address.toLowerCase());
|
roomListenersByAddress.remove(address.toLowerCase(Locale.US));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.pubsub;
|
package org.jivesoftware.smackx.pubsub;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,6 +50,6 @@ public enum FormNodeType
|
||||||
{
|
{
|
||||||
return CONFIGURE_OWNER;
|
return CONFIGURE_OWNER;
|
||||||
}
|
}
|
||||||
return valueOf(elem.toUpperCase());
|
return valueOf(elem.toUpperCase(Locale.US));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.pubsub;
|
package org.jivesoftware.smackx.pubsub;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,9 +77,9 @@ public enum PubSubElementType
|
||||||
|
|
||||||
if (fragment != null)
|
if (fragment != null)
|
||||||
{
|
{
|
||||||
return valueOf((elemName + '_' + fragment).toUpperCase());
|
return valueOf((elemName + '_' + fragment).toUpperCase(Locale.US));
|
||||||
}
|
}
|
||||||
return valueOf(elemName.toUpperCase().replace('-', '_'));
|
return valueOf(elemName.toUpperCase(Locale.US).replace('-', '_'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.pubsub.packet;
|
package org.jivesoftware.smackx.pubsub.packet;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines all the valid namespaces that are used with the {@link PubSub} packet
|
* Defines all the valid namespaces that are used with the {@link PubSub} packet
|
||||||
* as defined by the specification.
|
* as defined by the specification.
|
||||||
|
@ -58,7 +60,7 @@ public enum PubSubNamespace
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
String suffix = ns.substring(ns.lastIndexOf('#')+1);
|
String suffix = ns.substring(ns.lastIndexOf('#')+1);
|
||||||
return valueOf(suffix.toUpperCase());
|
return valueOf(suffix.toUpperCase(Locale.US));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return BASIC;
|
return BASIC;
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.jingle.media;
|
package org.jivesoftware.smackx.jingle.media;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content info. Content info messages are complementary messages that can be
|
* Content info. Content info messages are complementary messages that can be
|
||||||
* transmitted for informing of events like "busy", "ringtone", etc.
|
* transmitted for informing of events like "busy", "ringtone", etc.
|
||||||
|
@ -55,7 +57,7 @@ public abstract class ContentInfo {
|
||||||
* Returns the MediaInfo constant associated with the String value.
|
* Returns the MediaInfo constant associated with the String value.
|
||||||
*/
|
*/
|
||||||
public static ContentInfo fromString(String value) {
|
public static ContentInfo fromString(String value) {
|
||||||
value = value.toLowerCase();
|
value = value.toLowerCase(Locale.US);
|
||||||
if (value.equals("busy")) {
|
if (value.equals("busy")) {
|
||||||
return BUSY;
|
return BUSY;
|
||||||
} else if (value.equals("hold")) {
|
} else if (value.equals("hold")) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.net.UnknownHostException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
|
@ -468,7 +469,7 @@ public abstract class TransportCandidate {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return UDP;
|
return UDP;
|
||||||
}
|
}
|
||||||
value = value.toLowerCase();
|
value = value.toLowerCase(Locale.US);
|
||||||
if (value.equals("udp")) {
|
if (value.equals("udp")) {
|
||||||
return UDP;
|
return UDP;
|
||||||
} else if (value.equals("tcp")) {
|
} else if (value.equals("tcp")) {
|
||||||
|
@ -552,7 +553,7 @@ public abstract class TransportCandidate {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return MYRTPVOICE;
|
return MYRTPVOICE;
|
||||||
}
|
}
|
||||||
value = value.toLowerCase();
|
value = value.toLowerCase(Locale.US);
|
||||||
if (value.equals("myrtpvoice")) {
|
if (value.equals("myrtpvoice")) {
|
||||||
return MYRTPVOICE;
|
return MYRTPVOICE;
|
||||||
} else if (value.equals("tcp")) {
|
} else if (value.equals("tcp")) {
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
package org.jivesoftware.smackx.jingle.packet;
|
package org.jivesoftware.smackx.jingle.packet;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.jivesoftware.smack.packet.PacketExtension;
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
import org.jivesoftware.smack.provider.PacketExtensionProvider;
|
import org.jivesoftware.smack.provider.PacketExtensionProvider;
|
||||||
import org.jivesoftware.smackx.jingle.media.ContentInfo;
|
import org.jivesoftware.smackx.jingle.media.ContentInfo;
|
||||||
|
@ -87,7 +89,7 @@ public class JingleError implements PacketExtension {
|
||||||
*/
|
*/
|
||||||
public static JingleError fromString(String value) {
|
public static JingleError fromString(String value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
value = value.toLowerCase();
|
value = value.toLowerCase(Locale.US);
|
||||||
if (value.equals("out-of-order")) {
|
if (value.equals("out-of-order")) {
|
||||||
return OUT_OF_ORDER;
|
return OUT_OF_ORDER;
|
||||||
} else if (value.equals("unknown-session")) {
|
} else if (value.equals("unknown-session")) {
|
||||||
|
|
|
@ -34,6 +34,7 @@ import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
@ -180,7 +181,7 @@ public class AgentRoster {
|
||||||
synchronized (entries) {
|
synchronized (entries) {
|
||||||
for (Iterator<String> i = entries.iterator(); i.hasNext();) {
|
for (Iterator<String> i = entries.iterator(); i.hasNext();) {
|
||||||
String entry = i.next();
|
String entry = i.next();
|
||||||
if (entry.toLowerCase().equals(jid.toLowerCase())) {
|
if (entry.toLowerCase(Locale.US).equals(jid.toLowerCase())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,7 +249,7 @@ public class AgentRoster {
|
||||||
private String getPresenceMapKey(String user) {
|
private String getPresenceMapKey(String user) {
|
||||||
String key = user;
|
String key = user;
|
||||||
if (!contains(user)) {
|
if (!contains(user)) {
|
||||||
key = StringUtils.parseBareAddress(user).toLowerCase();
|
key = StringUtils.parseBareAddress(user).toLowerCase(Locale.US);
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
@ -322,7 +323,7 @@ public class AgentRoster {
|
||||||
synchronized (entries) {
|
synchronized (entries) {
|
||||||
for (Iterator<String> i = entries.iterator(); i.hasNext();) {
|
for (Iterator<String> i = entries.iterator(); i.hasNext();) {
|
||||||
String entry = i.next();
|
String entry = i.next();
|
||||||
if (entry.toLowerCase().equals(StringUtils.parseBareAddress(key).toLowerCase())) {
|
if (entry.toLowerCase(Locale.US).equals(StringUtils.parseBareAddress(key).toLowerCase())) {
|
||||||
fireEvent(EVENT_PRESENCE_CHANGED, packet);
|
fireEvent(EVENT_PRESENCE_CHANGED, packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -343,7 +344,7 @@ public class AgentRoster {
|
||||||
synchronized (entries) {
|
synchronized (entries) {
|
||||||
for (Iterator<String> i = entries.iterator(); i.hasNext();) {
|
for (Iterator<String> i = entries.iterator(); i.hasNext();) {
|
||||||
String entry = (String)i.next();
|
String entry = (String)i.next();
|
||||||
if (entry.toLowerCase().equals(StringUtils.parseBareAddress(key).toLowerCase())) {
|
if (entry.toLowerCase(Locale.US).equals(StringUtils.parseBareAddress(key).toLowerCase())) {
|
||||||
fireEvent(EVENT_PRESENCE_CHANGED, packet);
|
fireEvent(EVENT_PRESENCE_CHANGED, packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ public class WorkgroupQueue {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
type = type.toLowerCase();
|
type = type.toLowerCase(Locale.US);
|
||||||
if (OPEN.toString().equals(type)) {
|
if (OPEN.toString().equals(type)) {
|
||||||
return OPEN;
|
return OPEN;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a socket connection to a XMPP server. This is the default connection
|
* Creates a socket connection to a XMPP server. This is the default connection
|
||||||
|
@ -223,7 +224,7 @@ public class TCPConnection extends XMPPConnection {
|
||||||
throw new AlreadyLoggedInException();
|
throw new AlreadyLoggedInException();
|
||||||
}
|
}
|
||||||
// Do partial version of nameprep on the username.
|
// Do partial version of nameprep on the username.
|
||||||
username = username.toLowerCase().trim();
|
username = username.toLowerCase(Locale.US).trim();
|
||||||
|
|
||||||
String response;
|
String response;
|
||||||
if (saslAuthentication.hasNonAnonymousAuthentication()) {
|
if (saslAuthentication.hasNonAnonymousAuthentication()) {
|
||||||
|
|
Loading…
Reference in a new issue