Merge pull request #41 from tailscale/digits

java: format strings containing integers in ROOT locale.
pull/40/head
Denton Gentry 3 years ago committed by GitHub
commit b0f1428443
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -54,6 +54,7 @@ import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
@ -373,7 +374,7 @@ public class App extends Application {
try {
// Android doesn't have a supportsBroadcast() but the Go net.Interface wants
// one, so we say the interface has broadcast if it has multicast.
sb.append(String.format("%s %d %d %b %b %b %b %b |", nif.getName(),
sb.append(String.format(java.util.Locale.ROOT, "%s %d %d %b %b %b %b %b |", nif.getName(),
nif.getIndex(), nif.getMTU(), nif.isUp(), nif.supportsMulticast(),
nif.isLoopback(), nif.isPointToPoint(), nif.supportsMulticast()));
@ -381,7 +382,7 @@ public class App extends Application {
// InterfaceAddress == hostname + "/" + IP
String[] parts = ia.toString().split("/", 0);
if (parts.length > 1) {
sb.append(String.format("%s/%d ", parts[1], ia.getNetworkPrefixLength()));
sb.append(String.format(java.util.Locale.ROOT, "%s/%d ", parts[1], ia.getNetworkPrefixLength()));
}
}
} catch (Exception e) {

@ -19,6 +19,7 @@ import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
// Tailscale DNS Config retrieval
//
@ -229,7 +230,7 @@ public class DnsConfig {
String intToInetString(int hostAddress) {
return String.format("%d.%d.%d.%d",
return String.format(java.util.Locale.ROOT, "%d.%d.%d.%d",
(byte)(0xff & hostAddress),
(byte)(0xff & (hostAddress >> 8)),
(byte)(0xff & (hostAddress >> 16)),

Loading…
Cancel
Save