Remove ip null checks directly before a call to IpUtils#isValidIp, as IpUtils#isValidIp will perform a null check automatically

This commit is contained in:
Colin McDonald 2016-07-13 19:37:51 -04:00
parent f04ee19b6c
commit ea70e1b347
3 changed files with 4 additions and 4 deletions

View File

@ -410,7 +410,7 @@ public final class User {
return; return;
} }
if (ip == null || !IpUtils.isValidIp(ip)) { if (!IpUtils.isValidIp(ip)) {
callback.onResult(RequiresTotpResult.REQUIRED_NO_EXEMPTIONS, null); callback.onResult(RequiresTotpResult.REQUIRED_NO_EXEMPTIONS, null);
return; return;
} }

View File

@ -25,7 +25,7 @@ public final class GETUsersIdRequiresTotp implements Handler<RoutingContext> {
String userIp = ctx.request().getParam("userIp"); String userIp = ctx.request().getParam("userIp");
if (userIp != null && IpUtils.isValidIp(userIp)) { if (IpUtils.isValidIp(userIp)) {
ErrorUtils.respondInvalidInput(ctx, "Ip address \"" + userIp + "\" is not valid."); ErrorUtils.respondInvalidInput(ctx, "Ip address \"" + userIp + "\" is not valid.");
return; return;
} }

View File

@ -26,7 +26,7 @@ public class TotpUtils {
} }
public static void isPreAuthorized(User user, String ip, SingleResultCallback<Boolean> callback) { public static void isPreAuthorized(User user, String ip, SingleResultCallback<Boolean> callback) {
if (ip == null || !IpUtils.isValidIp(ip)) { if (!IpUtils.isValidIp(ip)) {
callback.onResult(false, null); callback.onResult(false, null);
return; return;
} }
@ -41,7 +41,7 @@ public class TotpUtils {
} }
public static void markPreAuthorized(User user, String ip, long duration, TimeUnit unit, SingleResultCallback<Void> callback) { public static void markPreAuthorized(User user, String ip, long duration, TimeUnit unit, SingleResultCallback<Void> callback) {
if (ip == null || !IpUtils.isValidIp(ip)) { if (!IpUtils.isValidIp(ip)) {
callback.onResult(null, null); callback.onResult(null, null);
return; return;
} }