mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 17:49:38 +02: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
|
@ -16,6 +16,8 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.bytestreams.ibb.packet;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType;
|
||||
|
@ -120,7 +122,7 @@ public class Open extends IQ {
|
|||
buf.append(sessionID);
|
||||
buf.append("\" ");
|
||||
buf.append("stanza=\"");
|
||||
buf.append(stanza.toString().toLowerCase());
|
||||
buf.append(stanza.toString().toLowerCase(Locale.US));
|
||||
buf.append("\"");
|
||||
buf.append("/>");
|
||||
return buf.toString();
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.bytestreams.ibb.provider;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.provider.IQProvider;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType;
|
||||
|
@ -39,7 +41,7 @@ public class OpenIQProvider implements IQProvider {
|
|||
stanza = StanzaType.IQ;
|
||||
}
|
||||
else {
|
||||
stanza = StanzaType.valueOf(stanzaValue.toUpperCase());
|
||||
stanza = StanzaType.valueOf(stanzaValue.toUpperCase(Locale.US));
|
||||
}
|
||||
|
||||
return new Open(sessionID, blockSize, stanza);
|
||||
|
|
|
@ -54,6 +54,7 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.SortedSet;
|
||||
|
@ -278,7 +279,7 @@ public class EntityCapsManager extends Manager {
|
|||
CapsExtension ext = (CapsExtension) packet.getExtension(EntityCapsManager.ELEMENT,
|
||||
EntityCapsManager.NAMESPACE);
|
||||
|
||||
String hash = ext.getHash().toLowerCase();
|
||||
String hash = ext.getHash().toLowerCase(Locale.US);
|
||||
if (!SUPPORTED_HASHES.containsKey(hash))
|
||||
return;
|
||||
|
||||
|
@ -560,7 +561,7 @@ public class EntityCapsManager extends Manager {
|
|||
* supported
|
||||
*/
|
||||
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)
|
||||
return null;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Collections;
|
|||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
@ -169,7 +170,7 @@ public class MultiUserChat {
|
|||
*/
|
||||
public MultiUserChat(XMPPConnection connection, String room) {
|
||||
this.connection = connection;
|
||||
this.room = room.toLowerCase();
|
||||
this.room = room.toLowerCase(Locale.US);
|
||||
init();
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.jivesoftware.smack.packet.Packet;
|
|||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
@ -150,21 +151,21 @@ class RoomListenerMultiplexor extends AbstractConnectionListener {
|
|||
if (from == null) {
|
||||
return false;
|
||||
}
|
||||
return roomAddressTable.containsKey(StringUtils.parseBareAddress(from).toLowerCase());
|
||||
return roomAddressTable.containsKey(StringUtils.parseBareAddress(from).toLowerCase(Locale.US));
|
||||
}
|
||||
|
||||
public void addRoom(String address) {
|
||||
if (address == null) {
|
||||
return;
|
||||
}
|
||||
roomAddressTable.put(address.toLowerCase(), address);
|
||||
roomAddressTable.put(address.toLowerCase(Locale.US), address);
|
||||
}
|
||||
|
||||
public void removeRoom(String address) {
|
||||
if (address == null) {
|
||||
return;
|
||||
}
|
||||
roomAddressTable.remove(address.toLowerCase());
|
||||
roomAddressTable.remove(address.toLowerCase(Locale.US));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,7 +192,7 @@ class RoomListenerMultiplexor extends AbstractConnectionListener {
|
|||
}
|
||||
|
||||
PacketMultiplexListener listener =
|
||||
roomListenersByAddress.get(StringUtils.parseBareAddress(from).toLowerCase());
|
||||
roomListenersByAddress.get(StringUtils.parseBareAddress(from).toLowerCase(Locale.US));
|
||||
|
||||
if (listener != null) {
|
||||
listener.processPacket(p);
|
||||
|
@ -202,14 +203,14 @@ class RoomListenerMultiplexor extends AbstractConnectionListener {
|
|||
if (address == null) {
|
||||
return;
|
||||
}
|
||||
roomListenersByAddress.put(address.toLowerCase(), listener);
|
||||
roomListenersByAddress.put(address.toLowerCase(Locale.US), listener);
|
||||
}
|
||||
|
||||
public void removeRoom(String address) {
|
||||
if (address == null) {
|
||||
return;
|
||||
}
|
||||
roomListenersByAddress.remove(address.toLowerCase());
|
||||
roomListenersByAddress.remove(address.toLowerCase(Locale.US));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.pubsub;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
||||
|
||||
/**
|
||||
|
@ -48,6 +50,6 @@ public enum FormNodeType
|
|||
{
|
||||
return CONFIGURE_OWNER;
|
||||
}
|
||||
return valueOf(elem.toUpperCase());
|
||||
return valueOf(elem.toUpperCase(Locale.US));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.pubsub;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
||||
|
||||
/**
|
||||
|
@ -75,9 +77,9 @@ public enum PubSubElementType
|
|||
|
||||
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;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Defines all the valid namespaces that are used with the {@link PubSub} packet
|
||||
* as defined by the specification.
|
||||
|
@ -58,7 +60,7 @@ public enum PubSubNamespace
|
|||
if (index != -1)
|
||||
{
|
||||
String suffix = ns.substring(ns.lastIndexOf('#')+1);
|
||||
return valueOf(suffix.toUpperCase());
|
||||
return valueOf(suffix.toUpperCase(Locale.US));
|
||||
}
|
||||
else
|
||||
return BASIC;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue