1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-12 02:29: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:
Florian Schmaus 2014-04-03 22:50:13 +02:00
parent 94adaf8e50
commit d8a5610d7b
24 changed files with 67 additions and 39 deletions

View file

@ -16,6 +16,8 @@
*/
package org.jivesoftware.smackx.jingle.media;
import java.util.Locale;
/**
* Content info. Content info messages are complementary messages that can be
* 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.
*/
public static ContentInfo fromString(String value) {
value = value.toLowerCase();
value = value.toLowerCase(Locale.US);
if (value.equals("busy")) {
return BUSY;
} else if (value.equals("hold")) {

View file

@ -26,6 +26,7 @@ import java.net.UnknownHostException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.logging.Logger;
import org.jivesoftware.smack.XMPPConnection;
@ -468,7 +469,7 @@ public abstract class TransportCandidate {
if (value == null) {
return UDP;
}
value = value.toLowerCase();
value = value.toLowerCase(Locale.US);
if (value.equals("udp")) {
return UDP;
} else if (value.equals("tcp")) {
@ -552,7 +553,7 @@ public abstract class TransportCandidate {
if (value == null) {
return MYRTPVOICE;
}
value = value.toLowerCase();
value = value.toLowerCase(Locale.US);
if (value.equals("myrtpvoice")) {
return MYRTPVOICE;
} else if (value.equals("tcp")) {

View file

@ -17,6 +17,8 @@
package org.jivesoftware.smackx.jingle.packet;
import java.util.Locale;
import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.provider.PacketExtensionProvider;
import org.jivesoftware.smackx.jingle.media.ContentInfo;
@ -87,7 +89,7 @@ public class JingleError implements PacketExtension {
*/
public static JingleError fromString(String value) {
if (value != null) {
value = value.toLowerCase();
value = value.toLowerCase(Locale.US);
if (value.equals("out-of-order")) {
return OUT_OF_ORDER;
} else if (value.equals("unknown-session")) {