From d266fe8b74a1545e57ebfb560f6f2eb79291db8d Mon Sep 17 00:00:00 2001 From: Gravit Date: Sat, 20 Apr 2019 05:09:47 +0700 Subject: [PATCH] =?UTF-8?q?[FIX]=20=D0=A4=D0=B8=D0=BA=D1=81=D1=8B=20=D0=B0?= =?UTF-8?q?=D0=B2=D1=82=D0=BE=D0=B7=D0=B0=D0=BC=D0=B5=D0=BD=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/handler/JsonAuthHandler.java | 1 + .../command/dump/DumpEntryCacheCommand.java | 1 + .../command/dump/DumpSessionsCommand.java | 1 + .../command/hash/DownloadClientCommand.java | 1 + .../command/service/ComponentCommand.java | 1 + .../config/adapter/ComponentAdapter.java | 35 ------------------- .../config/adapter/ProtectHandlerAdapter.java | 35 ------------------- 7 files changed, 5 insertions(+), 70 deletions(-) delete mode 100644 LaunchServer/src/main/java/ru/gravit/launchserver/config/adapter/ComponentAdapter.java delete mode 100644 LaunchServer/src/main/java/ru/gravit/launchserver/config/adapter/ProtectHandlerAdapter.java diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/JsonAuthHandler.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/JsonAuthHandler.java index 9c0804e4..d661a537 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/JsonAuthHandler.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/handler/JsonAuthHandler.java @@ -1,5 +1,6 @@ package ru.gravit.launchserver.auth.handler; +import ru.gravit.launcher.Launcher; import ru.gravit.launchserver.LaunchServer; import ru.gravit.utils.HTTPRequest; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpEntryCacheCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpEntryCacheCommand.java index b2cec441..bafb2b60 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpEntryCacheCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpEntryCacheCommand.java @@ -1,5 +1,6 @@ package ru.gravit.launchserver.command.dump; +import ru.gravit.launcher.Launcher; import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.auth.AuthProviderPair; import ru.gravit.launchserver.auth.handler.CachedAuthHandler; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpSessionsCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpSessionsCommand.java index bfb25d90..503e4335 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpSessionsCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/dump/DumpSessionsCommand.java @@ -1,6 +1,7 @@ package ru.gravit.launchserver.command.dump; import com.google.gson.reflect.TypeToken; +import ru.gravit.launcher.Launcher; import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.command.Command; import ru.gravit.launchserver.socket.Client; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/hash/DownloadClientCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/hash/DownloadClientCommand.java index fc5b32cf..6a6c31fb 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/hash/DownloadClientCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/hash/DownloadClientCommand.java @@ -1,5 +1,6 @@ package ru.gravit.launchserver.command.hash; +import ru.gravit.launcher.Launcher; import ru.gravit.launcher.profiles.ClientProfile; import ru.gravit.launcher.profiles.ClientProfile.Version; import ru.gravit.launchserver.LaunchServer; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/ComponentCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/ComponentCommand.java index 448a6f33..290d6f5d 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/ComponentCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/service/ComponentCommand.java @@ -1,5 +1,6 @@ package ru.gravit.launchserver.command.service; +import ru.gravit.launcher.Launcher; import ru.gravit.launcher.NeedGarbageCollection; import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.command.Command; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/config/adapter/ComponentAdapter.java b/LaunchServer/src/main/java/ru/gravit/launchserver/config/adapter/ComponentAdapter.java deleted file mode 100644 index b4b9e312..00000000 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/config/adapter/ComponentAdapter.java +++ /dev/null @@ -1,35 +0,0 @@ -package ru.gravit.launchserver.config.adapter; - -import com.google.gson.*; -import ru.gravit.launchserver.components.Component; -import ru.gravit.utils.helper.LogHelper; - -import java.lang.reflect.Type; - -public class ComponentAdapter implements JsonSerializer, JsonDeserializer { - private static final String PROP_NAME = "component"; - - @Override - public Component deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { - String typename = json.getAsJsonObject().getAsJsonPrimitive(PROP_NAME).getAsString(); - Class cls = Component.getComponentClass(typename); - if (cls == null) { - LogHelper.error("Component %s not found", typename); - return null; - } - - - return (Component) context.deserialize(json, cls); - } - - @Override - public JsonElement serialize(Component src, Type typeOfSrc, JsonSerializationContext context) { - JsonObject jo = context.serialize(src).getAsJsonObject(); - - @SuppressWarnings("unchecked") - String classPath = Component.getComponentName((Class) src.getClass()); - jo.add(PROP_NAME, new JsonPrimitive(classPath)); - - return jo; - } -} diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/config/adapter/ProtectHandlerAdapter.java b/LaunchServer/src/main/java/ru/gravit/launchserver/config/adapter/ProtectHandlerAdapter.java deleted file mode 100644 index 48fca6f8..00000000 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/config/adapter/ProtectHandlerAdapter.java +++ /dev/null @@ -1,35 +0,0 @@ -package ru.gravit.launchserver.config.adapter; - -import com.google.gson.*; -import ru.gravit.launchserver.auth.protect.ProtectHandler; -import ru.gravit.utils.helper.LogHelper; - -import java.lang.reflect.Type; - -public class ProtectHandlerAdapter implements JsonSerializer, JsonDeserializer { - private static final String PROP_NAME = "type"; - - @Override - public ProtectHandler deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { - String typename = json.getAsJsonObject().getAsJsonPrimitive(PROP_NAME).getAsString(); - Class cls = ProtectHandler.getHandlerClass(typename); - if (cls == null) { - LogHelper.error("ProtectHandler %s not found", typename); - return null; - } - - - return (ProtectHandler) context.deserialize(json, cls); - } - - @Override - public JsonElement serialize(ProtectHandler src, Type typeOfSrc, JsonSerializationContext context) { - JsonObject jo = context.serialize(src).getAsJsonObject(); - - @SuppressWarnings("unchecked") - String classPath = ProtectHandler.getHandlerName((Class) src.getClass()); - jo.add(PROP_NAME, new JsonPrimitive(classPath)); - - return jo; - } -}