Skip to content

Commit 2b1d9d1

Browse files
committed
Use root locale for String.format
1 parent 61ecab5 commit 2b1d9d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server/src/test/java/org/elasticsearch/common/network/InetAddressesTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.net.UnknownHostException;
2828
import java.nio.charset.StandardCharsets;
2929
import java.util.Enumeration;
30+
import java.util.Locale;
3031

3132
import static org.hamcrest.Matchers.equalTo;
3233

@@ -265,7 +266,7 @@ public void testAppendHexBytes() {
265266
byte b1 = randomByte();
266267
byte b2 = randomByte();
267268
// The expected string is the hex representation of the two bytes, padded to 4 characters
268-
String expected = String.format("%1$04x", (b1 & 0xFF) << 8 | b2 & 0xFF);
269+
String expected = String.format(Locale.ROOT, "%1$04x", (b1 & 0xFF) << 8 | b2 & 0xFF);
269270
byte[] hex = new byte[4];
270271
InetAddresses.appendHexBytes(hex, 0, b1, b2);
271272
String actual = new String(hex, StandardCharsets.US_ASCII);

0 commit comments

Comments
 (0)