Make some changes to make IntelliJ's code inspection happier

This commit is contained in:
Colin McDonald 2016-06-25 18:41:44 -04:00
parent a648fb7f30
commit fde7d50edc
22 changed files with 23 additions and 50 deletions

View File

@ -99,7 +99,7 @@ public final class APIv3 extends AbstractVerticle {
@Getter private static Vertx vertxInstance; @Getter private static Vertx vertxInstance;
@Getter private static MongoDatabase database; @Getter private static MongoDatabase database;
@Getter private static Properties config = new Properties(); @Getter private static final Properties config = new Properties();
private static final Gson gson = new GsonBuilder() private static final Gson gson = new GsonBuilder()
.registerTypeAdapter(Instant.class, new InstantTypeAdapter()) .registerTypeAdapter(Instant.class, new InstantTypeAdapter())
.setExclusionStrategies(new FollowAnnotationExclusionStrategy()) .setExclusionStrategies(new FollowAnnotationExclusionStrategy())

View File

@ -21,7 +21,7 @@ public enum MaxMindUserType {
TRAVELER(true), TRAVELER(true),
UNKNOWN(true); UNKNOWN(true);
@Getter private boolean allowed; @Getter private final boolean allowed;
MaxMindUserType(boolean allowed) { MaxMindUserType(boolean allowed) {
this.allowed = allowed; this.allowed = allowed;

View File

@ -43,10 +43,7 @@ public final class BannedAsn {
static { static {
updateCache(); updateCache();
APIv3.getVertxInstance().setPeriodic(TimeUnit.MINUTES.toMillis(1), (id) -> updateCache());
APIv3.getVertxInstance().setPeriodic(TimeUnit.MINUTES.toMillis(1), (id) -> {
updateCache();
});
} }
private static void updateCache() { private static void updateCache() {

View File

@ -43,10 +43,7 @@ public final class Rank {
static { static {
updateCache(); updateCache();
APIv3.getVertxInstance().setPeriodic(TimeUnit.MINUTES.toMillis(1), (id) -> updateCache());
APIv3.getVertxInstance().setPeriodic(TimeUnit.MINUTES.toMillis(1), (id) -> {
updateCache();
});
} }
private static void updateCache() { private static void updateCache() {

View File

@ -45,10 +45,7 @@ public final class Server {
static { static {
updateCache(); updateCache();
APIv3.getVertxInstance().setPeriodic(TimeUnit.MINUTES.toMillis(1), (id) -> updateCache());
APIv3.getVertxInstance().setPeriodic(TimeUnit.MINUTES.toMillis(1), (id) -> {
updateCache();
});
} }
private static void updateCache() { private static void updateCache() {

View File

@ -41,10 +41,7 @@ public final class ServerGroup {
static { static {
updateCache(); updateCache();
APIv3.getVertxInstance().setPeriodic(TimeUnit.MINUTES.toMillis(1), (id) -> updateCache());
APIv3.getVertxInstance().setPeriodic(TimeUnit.MINUTES.toMillis(1), (id) -> {
updateCache();
});
} }
private static void updateCache() { private static void updateCache() {

View File

@ -22,7 +22,7 @@ public final class GETAuditLog implements Handler<RoutingContext> {
APIv3.respondJson(ctx, auditLog); APIv3.respondJson(ctx, auditLog);
} }
}); });
} catch (NumberFormatException ex) { } catch (NumberFormatException ignored) {
ErrorUtils.respondInvalidInput(ctx, "skip and pageSize must be numerical inputs."); ErrorUtils.respondInvalidInput(ctx, "skip and pageSize must be numerical inputs.");
} }
} }

View File

@ -32,7 +32,7 @@ public final class POSTAuditLog implements Handler<RoutingContext> {
try { try {
type = AuditLogActionType.valueOf(requestBody.getString("type")); type = AuditLogActionType.valueOf(requestBody.getString("type"));
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ignored) {
ErrorUtils.respondNotFound(ctx, "Audit log action type", requestBody.getString("type")); ErrorUtils.respondNotFound(ctx, "Audit log action type", requestBody.getString("type"));
return; return;
} }

View File

@ -21,7 +21,7 @@ public final class GETGrants implements Handler<RoutingContext> {
APIv3.respondJson(ctx, grants); APIv3.respondJson(ctx, grants);
} }
}); });
} catch (NumberFormatException ex) { } catch (NumberFormatException ignored) {
ErrorUtils.respondInvalidInput(ctx, "skip and pageSize must be numerical inputs."); ErrorUtils.respondInvalidInput(ctx, "skip and pageSize must be numerical inputs.");
} }
} }

View File

@ -21,7 +21,7 @@ public final class GETIpBans implements Handler<RoutingContext> {
APIv3.respondJson(ctx, grants); APIv3.respondJson(ctx, grants);
} }
}); });
} catch (NumberFormatException ex) { } catch (NumberFormatException ignored) {
ErrorUtils.respondInvalidInput(ctx, "skip and pageSize must be numerical inputs."); ErrorUtils.respondInvalidInput(ctx, "skip and pageSize must be numerical inputs.");
} }
} }

View File

@ -21,7 +21,7 @@ public final class GETPunishments implements Handler<RoutingContext> {
APIv3.respondJson(ctx, grants); APIv3.respondJson(ctx, grants);
} }
}); });
} catch (NumberFormatException ex) { } catch (NumberFormatException ignored) {
ErrorUtils.respondInvalidInput(ctx, "skip and pageSize must be numerical inputs."); ErrorUtils.respondInvalidInput(ctx, "skip and pageSize must be numerical inputs.");
} }
} }

View File

@ -114,11 +114,7 @@ public final class POSTServersHeartbeat implements Handler<RoutingContext> {
} }
Map<String, Object> response = new HashMap<>(); Map<String, Object> response = new HashMap<>();
loginInfoFutures.forEach((uuid, loginInfo) -> response.put(uuid.toString(), loginInfo.result()));
loginInfoFutures.forEach((uuid, loginInfo) -> {
response.put(uuid.toString(), loginInfo.result());
});
callback.complete(response); callback.complete(response);
}); });
}); });

View File

@ -11,7 +11,7 @@ import java.time.Instant;
public final class InstantJsonDeserializer extends JsonDeserializer<Instant> { public final class InstantJsonDeserializer extends JsonDeserializer<Instant> {
@Override @Override
public Instant deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { public Instant deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
return Instant.ofEpochMilli(jsonParser.getValueAsLong()); return Instant.ofEpochMilli(jsonParser.getValueAsLong());
} }

View File

@ -11,7 +11,7 @@ import java.time.Instant;
public final class InstantJsonSerializer extends JsonSerializer<Instant> { public final class InstantJsonSerializer extends JsonSerializer<Instant> {
@Override @Override
public void serialize(Instant instant, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException { public void serialize(Instant instant, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeNumber(instant.toEpochMilli()); jsonGenerator.writeNumber(instant.toEpochMilli());
} }

View File

@ -11,7 +11,7 @@ import java.util.UUID;
public final class UuidJsonDeserializer extends JsonDeserializer<UUID> { public final class UuidJsonDeserializer extends JsonDeserializer<UUID> {
@Override @Override
public UUID deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { public UUID deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
return UUID.fromString(jsonParser.getValueAsString()); return UUID.fromString(jsonParser.getValueAsString());
} }

View File

@ -11,7 +11,7 @@ import java.util.UUID;
public final class UuidJsonSerializer extends JsonSerializer<UUID> { public final class UuidJsonSerializer extends JsonSerializer<UUID> {
@Override @Override
public void serialize(UUID uuid, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException { public void serialize(UUID uuid, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeString(uuid.toString()); jsonGenerator.writeString(uuid.toString());
} }

View File

@ -8,7 +8,7 @@ import org.bson.codecs.EncoderContext;
import java.util.UUID; import java.util.UUID;
public final class UuidCodec implements Codec<UUID> { final class UuidCodec implements Codec<UUID> {
@Override @Override
public UUID decode(BsonReader bsonReader, DecoderContext decoderContext) { public UUID decode(BsonReader bsonReader, DecoderContext decoderContext) {

View File

@ -10,7 +10,7 @@ public enum TotpAuthorizationResult {
NOT_AUTHORIZED_RECENTLY_USED(false), NOT_AUTHORIZED_RECENTLY_USED(false),
NOT_AUTHORIZED_BAD_CODE(false); NOT_AUTHORIZED_BAD_CODE(false);
@Getter private boolean authorized; @Getter private final boolean authorized;
TotpAuthorizationResult(boolean authorized) { TotpAuthorizationResult(boolean authorized) {
this.authorized = authorized; this.authorized = authorized;

View File

@ -20,13 +20,8 @@ public class MandrillUtils {
.put("message", message); .put("message", message);
httpClient.post("mandrillapp.com", "/api/1.0/messages/send.json", (response) -> { httpClient.post("mandrillapp.com", "/api/1.0/messages/send.json", (response) -> {
response.bodyHandler((resultBody) -> { response.bodyHandler((ignored) -> callback.onResult(null, null));
callback.onResult(null, null); response.exceptionHandler((error) -> callback.onResult(null, error));
});
response.exceptionHandler((error) -> {
callback.onResult(null, error);
});
}) })
.putHeader(HttpHeaders.CONTENT_TYPE, MediaType.JSON_UTF_8.toString()) .putHeader(HttpHeaders.CONTENT_TYPE, MediaType.JSON_UTF_8.toString())
.end(body.encode()); .end(body.encode());

View File

@ -27,9 +27,7 @@ public class MaxMindUtils {
callback.onResult(new MaxMindResult(bodyJson), null); callback.onResult(new MaxMindResult(bodyJson), null);
}); });
response.exceptionHandler((error) -> { response.exceptionHandler((error) -> callback.onResult(null, error));
callback.onResult(null, error);
});
}) })
.putHeader("Authorization", authHeader) .putHeader("Authorization", authHeader)
.end(); .end();

View File

@ -33,9 +33,7 @@ public class MojangUtils {
} }
}); });
response.exceptionHandler((error) -> { response.exceptionHandler((error) -> callback.onResult(null, error));
callback.onResult(null, error);
});
}).end(); }).end();
} }

View File

@ -37,9 +37,7 @@ public class ZangUtils {
} }
}); });
response.exceptionHandler((error) -> { response.exceptionHandler((error) -> callback.onResult(null, error));
callback.onResult(null, error);
});
}) })
.putHeader("Authorization", authHeader) .putHeader("Authorization", authHeader)
.putHeader(HttpHeaders.CONTENT_TYPE, MediaType.JSON_UTF_8.toString()) .putHeader(HttpHeaders.CONTENT_TYPE, MediaType.JSON_UTF_8.toString())