From 6cd5a69149caa80b1300707cabf054b413b2f157 Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Wed, 1 Nov 2023 00:10:19 +0700 Subject: [PATCH] [FEATURE] ModuleLaunch bug fix --- .../pro/gravit/utils/launch/ModuleLaunch.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/LauncherCore/src/main/java11/pro/gravit/utils/launch/ModuleLaunch.java b/LauncherCore/src/main/java11/pro/gravit/utils/launch/ModuleLaunch.java index 45286e79..bef68378 100644 --- a/LauncherCore/src/main/java11/pro/gravit/utils/launch/ModuleLaunch.java +++ b/LauncherCore/src/main/java11/pro/gravit/utils/launch/ModuleLaunch.java @@ -2,6 +2,7 @@ import pro.gravit.utils.helper.IOHelper; import pro.gravit.utils.helper.JVMHelper; +import pro.gravit.utils.helper.LogHelper; import java.io.IOException; import java.io.InputStream; @@ -133,8 +134,16 @@ protected Class loadClass(String name, boolean resolve) throws ClassNotFoundE } @Override - protected Class findClass(String moduleName, String name) { + protected Class findClass(String name) throws ClassNotFoundException { + var clazz = findClass(null, name); + if(clazz == null) { + throw new ClassNotFoundException(name); + } + return clazz; + } + @Override + protected Class findClass(String moduleName, String name) { Class clazz; { clazz = classMap.get(name); @@ -164,7 +173,11 @@ protected Class findClass(String moduleName, String name) { } } if(clazz == null) { - clazz = super.findClass(moduleName, name); + try { + clazz = super.findClass(name); + } catch (ClassNotFoundException e) { + return null; + } } if(clazz != null) { classMap.put(name, clazz);