diff --git a/.gitignore b/.gitignore index 1369af48..46a38783 100644 --- a/.gitignore +++ b/.gitignore @@ -109,3 +109,4 @@ cmd.bat cmd.sh ## PVS Studio .PVS-Studio/ +project/target diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/PostgreSQLSourceConfig.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/PostgreSQLSourceConfig.java index b6180efb..9de90848 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/PostgreSQLSourceConfig.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/PostgreSQLSourceConfig.java @@ -43,8 +43,8 @@ public synchronized Connection getConnection() throws SQLException { PGSimpleDataSource postgresqlSource = new PGSimpleDataSource(); // Set credentials - postgresqlSource.setServerName(address); - postgresqlSource.setPortNumber(port); + postgresqlSource.setServerNames(new String[] {address}); //TODO support multinode PostgreSQL DB + postgresqlSource.setPortNumbers(new int[] {port}); postgresqlSource.setUser(username); postgresqlSource.setPassword(password); postgresqlSource.setDatabaseName(database); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/UnindexAssetCommand.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/UnindexAssetCommand.java index ffe36636..5c4e811a 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/UnindexAssetCommand.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/UnindexAssetCommand.java @@ -16,8 +16,6 @@ import java.util.Map; public final class UnindexAssetCommand extends Command { - private static final JsonParser parser = new JsonParser(); - public UnindexAssetCommand(LaunchServer server) { super(server); } @@ -51,7 +49,7 @@ public void invoke(String... args) throws Exception { JsonObject objects; LogHelper.subInfo("Reading asset index file: '%s'", indexFileName); try (BufferedReader reader = IOHelper.newReader(IndexAssetCommand.resolveIndexFile(inputAssetDir, indexFileName))) { - objects = parser.parse(reader).getAsJsonObject().get("objects").getAsJsonObject(); + objects = JsonParser.parseReader(reader).getAsJsonObject().get("objects").getAsJsonObject(); } // Restore objects diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ServerPinger.java b/Launcher/src/main/java/pro/gravit/launcher/client/ServerPinger.java index 43f689d0..bec7a5ae 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ServerPinger.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ServerPinger.java @@ -20,7 +20,6 @@ import java.util.regex.Pattern; public final class ServerPinger { - private final JsonParser parser = new JsonParser(); public static final class Result { @@ -184,7 +183,7 @@ private Result modernPing(HInput input, HOutput output) throws IOException { } // Parse JSON response - JsonObject object = parser.parse(response).getAsJsonObject(); + JsonObject object = JsonParser.parseString(response).getAsJsonObject(); JsonObject playersObject = object.get("players").getAsJsonObject(); int online = playersObject.get("online").getAsInt(); int max = playersObject.get("max").getAsInt(); diff --git a/LauncherAuthlib/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilMinecraftSessionService.java b/LauncherAuthlib/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilMinecraftSessionService.java index b75e9014..4cc26f90 100644 --- a/LauncherAuthlib/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilMinecraftSessionService.java +++ b/LauncherAuthlib/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilMinecraftSessionService.java @@ -28,7 +28,6 @@ import java.util.UUID; public class YggdrasilMinecraftSessionService extends BaseMinecraftSessionService { - public static final JsonParser JSON_PARSER = new JsonParser(); public static final boolean NO_TEXTURES = Boolean.parseBoolean("launcher.com.mojang.authlib.noTextures"); public static void fillTextureProperties(GameProfile profile, PlayerProfile pp) { @@ -62,7 +61,7 @@ private static void getTexturesMojang(Map statusCode || statusCode > 300) { LogHelper.error("JsonRequest failed. Server response code %d", statusCode);