Make some changes to make IntelliJ's code inspection happier
This commit is contained in:
parent
a648fb7f30
commit
fde7d50edc
@ -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())
|
||||||
|
@ -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;
|
||||||
|
@ -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() {
|
||||||
|
@ -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() {
|
||||||
|
@ -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() {
|
||||||
|
@ -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() {
|
||||||
|
@ -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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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) {
|
||||||
|
@ -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;
|
||||||
|
@ -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());
|
||||||
|
@ -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();
|
||||||
|
@ -33,9 +33,7 @@ public class MojangUtils {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
response.exceptionHandler((error) -> {
|
response.exceptionHandler((error) -> callback.onResult(null, error));
|
||||||
callback.onResult(null, error);
|
|
||||||
});
|
|
||||||
}).end();
|
}).end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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())
|
||||||
|
Loading…
Reference in New Issue
Block a user