Merge pull request #867 from stokito/fix_sys_path

SPARK-2302 plugins/ofmeet: hide the NoSuchFieldException sys_paths
This commit is contained in:
ilyaHlevnoy 2024-08-21 22:07:36 +03:00 committed by GitHub
commit 604b4d24a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -401,14 +401,19 @@ public class SparkMeetPlugin implements Plugin, ChatRoomListener, GlobalMessageL
System.setProperty("java.library.path", newLibPath);
// this will reload the new setting
Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths");
fieldSysPath.setAccessible(true);
fieldSysPath.set(System.class.getClassLoader(), null);
try {
@SuppressWarnings("JavaReflectionMemberAccess")
Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths");
fieldSysPath.setAccessible(true);
fieldSysPath.set(System.class.getClassLoader(), null);
} catch (NoSuchFieldException ignored) {
// Happens on non Oracle JDK but has no influence since there is no cached field that needs a reset
}
}
}
catch (Exception e)
{
Log.warning(e.getMessage(), e);
Log.warning("Error during loading of Pade Meetings plugin", e);
}
}