mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Fix some other uses of toLowerCase() without a locale.
This commit is contained in:
@@ -6,6 +6,7 @@ import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -51,7 +52,7 @@ public class PrivacyUtils {
|
||||
}
|
||||
|
||||
private static String scrubIpv6Address(byte[] ipv6) {
|
||||
String hex = toHexString(ipv6).toLowerCase();
|
||||
String hex = toHexString(ipv6).toLowerCase(Locale.US);
|
||||
return hex.substring(0, 2) + "[scrubbed]" + hex.substring(30);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.jmock.Expectations;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.util.Locale;
|
||||
|
||||
import static java.lang.System.arraycopy;
|
||||
import static org.briarproject.bramble.api.contact.HandshakeLinkConstants.BASE32_LINK_BYTES;
|
||||
@@ -174,7 +175,7 @@ public class PendingContactFactoryImplTest extends BrambleMockTestCase {
|
||||
rawLink[0] = (byte) formatVersion;
|
||||
byte[] publicKeyBytes = publicKey.getEncoded();
|
||||
arraycopy(publicKeyBytes, 0, rawLink, 1, publicKeyBytes.length);
|
||||
String base32 = Base32.encode(rawLink).toLowerCase();
|
||||
String base32 = Base32.encode(rawLink).toLowerCase(Locale.US);
|
||||
assertEquals(BASE32_LINK_BYTES, base32.length());
|
||||
return base32;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ import org.briarproject.bramble.util.Base32;
|
||||
import org.briarproject.briar.api.client.MessageTracker;
|
||||
import org.briarproject.briar.api.client.MessageTracker.GroupCount;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import static java.lang.System.arraycopy;
|
||||
import static org.briarproject.bramble.api.contact.HandshakeLinkConstants.FORMAT_VERSION;
|
||||
import static org.briarproject.bramble.api.contact.HandshakeLinkConstants.RAW_LINK_BYTES;
|
||||
@@ -52,7 +54,7 @@ public class BriarTestUtils {
|
||||
byte[] publicKey = keyPair.getPublic().getEncoded();
|
||||
linkBytes[0] = FORMAT_VERSION;
|
||||
arraycopy(publicKey, 0, linkBytes, 1, RAW_LINK_BYTES - 1);
|
||||
return ("briar://" + Base32.encode(linkBytes)).toLowerCase();
|
||||
return ("briar://" + Base32.encode(linkBytes)).toLowerCase(Locale.US);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.briarproject.bramble.identity
|
||||
import org.briarproject.bramble.api.identity.Author
|
||||
import org.briarproject.briar.api.identity.AuthorInfo
|
||||
import org.briarproject.briar.headless.json.JsonDict
|
||||
import java.util.Locale
|
||||
|
||||
fun Author.output() = JsonDict(
|
||||
"formatVersion" to formatVersion,
|
||||
@@ -11,4 +12,4 @@ fun Author.output() = JsonDict(
|
||||
"publicKey" to publicKey.encoded
|
||||
)
|
||||
|
||||
fun AuthorInfo.Status.output() = name.toLowerCase()
|
||||
fun AuthorInfo.Status.output() = name.lowercase(Locale.US)
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.briarproject.bramble.identity.output
|
||||
import org.briarproject.briar.api.blog.BlogPostHeader
|
||||
import org.briarproject.briar.api.blog.MessageType
|
||||
import org.briarproject.briar.headless.json.JsonDict
|
||||
import java.util.Locale
|
||||
|
||||
internal fun BlogPostHeader.output(text: String) = JsonDict(
|
||||
"text" to text,
|
||||
@@ -18,4 +19,4 @@ internal fun BlogPostHeader.output(text: String) = JsonDict(
|
||||
"timestampReceived" to timeReceived
|
||||
)
|
||||
|
||||
internal fun MessageType.output() = name.toLowerCase()
|
||||
internal fun MessageType.output() = name.lowercase(Locale.US)
|
||||
|
||||
Reference in New Issue
Block a user