Fix locale usage

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld
2018-12-11 03:47:32 +01:00
parent b514717076
commit dc2463a0ab
12 changed files with 35 additions and 49 deletions
@@ -44,14 +44,11 @@ public final class Interface {
private final Optional<Integer> mtu;
private Interface(final Builder builder) {
if (builder.keyPair == null)
throw new IllegalArgumentException("Interfaces must have a private key");
// Defensively copy to ensure immutability even if the Builder is reused.
addresses = Collections.unmodifiableSet(new LinkedHashSet<>(builder.addresses));
dnsServers = Collections.unmodifiableSet(new LinkedHashSet<>(builder.dnsServers));
excludedApplications = Collections.unmodifiableSet(new LinkedHashSet<>(builder.excludedApplications));
keyPair = builder.keyPair;
keyPair = Objects.requireNonNull(builder.keyPair, "Interfaces must have a private key");
listenPort = builder.listenPort;
mtu = builder.mtu;
}
@@ -264,6 +261,8 @@ public final class Interface {
}
public Interface build() {
if (keyPair == null)
throw new IllegalArgumentException("Interfaces must have a private key");
return new Interface(this);
}