Quick cleanup across the board
- Clean up imports - Adjust method visibility - Drop in NonNull annotations where needed - Prevent potential NPEs from nulled getActivity calls - Remove unused methods Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
committed by
Jason A. Donenfeld
parent
592c5cbbd6
commit
ba862b166b
@@ -37,8 +37,8 @@ public class Tunnel extends BaseObservable implements Keyed<String> {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public static boolean isNameValid(@NonNull final CharSequence name) {
|
||||
return NAME_PATTERN.matcher(name).matches();
|
||||
public static boolean isNameInvalid(@NonNull final CharSequence name) {
|
||||
return !NAME_PATTERN.matcher(name).matches();
|
||||
}
|
||||
|
||||
public CompletionStage<Void> delete() {
|
||||
|
||||
@@ -66,7 +66,7 @@ public final class TunnelManager extends BaseObservable {
|
||||
}
|
||||
|
||||
public CompletionStage<Tunnel> create(@NonNull final String name, final Config config) {
|
||||
if (!Tunnel.isNameValid(name))
|
||||
if (Tunnel.isNameInvalid(name))
|
||||
return CompletableFuture.failedFuture(new IllegalArgumentException("Invalid name"));
|
||||
if (tunnels.containsKey(name)) {
|
||||
final String message = "Tunnel " + name + " already exists";
|
||||
@@ -190,7 +190,7 @@ public final class TunnelManager extends BaseObservable {
|
||||
}
|
||||
|
||||
CompletionStage<String> setTunnelName(final Tunnel tunnel, final String name) {
|
||||
if (!Tunnel.isNameValid(name))
|
||||
if (Tunnel.isNameInvalid(name))
|
||||
return CompletableFuture.failedFuture(new IllegalArgumentException("Invalid name"));
|
||||
if (tunnels.containsKey(name)) {
|
||||
final String message = "Tunnel " + name + " already exists";
|
||||
|
||||
Reference in New Issue
Block a user