config: Remove Locale based string format

The configurations are supposed to be in a very specific
format which is not user-facing and hence doesn't have to
be adjusted for locale avoiding both the redundancy as well
as potential breakages in the configuration file format from
different locales.

Fixes: 71c67aa24ae2 ("config: Minor cleanup")
Reported-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2018-07-24 13:39:50 +05:30 committed by Jason A. Donenfeld
parent 284e42647c
commit 7689905c78
2 changed files with 4 additions and 8 deletions

View File

@ -10,7 +10,6 @@ import android.support.annotation.Nullable;
import android.text.TextUtils; import android.text.TextUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -71,7 +70,7 @@ public enum Attribute {
} }
public String composeWith(final int value) { public String composeWith(final int value) {
return String.format(Locale.getDefault(), "%s = %d%n", token, value); return String.format("%s = %d%n", token, value);
} }
public <T> String composeWith(final Iterable<T> value) { public <T> String composeWith(final Iterable<T> value) {

View File

@ -25,7 +25,6 @@ import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Locale;
import java9.lang.Iterables; import java9.lang.Iterables;
@ -72,7 +71,7 @@ public class Peer {
private String getEndpointString() { private String getEndpointString() {
if (endpoint == null) if (endpoint == null)
return null; return null;
return String.format(Locale.getDefault(), "%s:%d", endpoint.getHostString(), endpoint.getPort()); return String.format("%s:%d", endpoint.getHostString(), endpoint.getPort());
} }
public int getPersistentKeepalive() { public int getPersistentKeepalive() {
@ -104,12 +103,10 @@ public class Peer {
if (endpoint.isUnresolved()) if (endpoint.isUnresolved())
throw new UnknownHostException(endpoint.getHostString()); throw new UnknownHostException(endpoint.getHostString());
if (endpoint.getAddress() instanceof Inet6Address) if (endpoint.getAddress() instanceof Inet6Address)
return String.format(Locale.getDefault(), return String.format("[%s]:%d",
"[%s]:%d",
endpoint.getAddress().getHostAddress(), endpoint.getAddress().getHostAddress(),
endpoint.getPort()); endpoint.getPort());
return String.format(Locale.getDefault(), return String.format("%s:%d",
"%s:%d",
endpoint.getAddress().getHostAddress(), endpoint.getAddress().getHostAddress(),
endpoint.getPort()); endpoint.getPort());
} }