Skip to content

Commit

Permalink
add: catch log
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Sep 2, 2022
1 parent 547c074 commit 01a6e38
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,25 +268,29 @@ object DebugCommands {
val cache = loader::class.java.getDeclaredField("pluginFileToInstanceMap")
.apply { isAccessible = true }
.get(loader) as MutableMap<File, JvmPlugin>
val permissions = PermissionService.INSTANCE.javaClass.getDeclaredField("permissions")
.apply { isAccessible = true }
.get(PermissionService.INSTANCE) as MutableMap<*, *>

PluginManager.disablePlugin(plugin = plugin)
try {
plugin.cancel()
} catch (_: Exception) {
//
} catch (cause: Exception) {
logger.warning({ "jvm plugin $id cancel throw exception." }, cause)
}
plugins.remove(plugin)
try {
val permissions = PermissionService.INSTANCE.javaClass.getDeclaredField("permissions")
.apply { isAccessible = true }
.get(PermissionService.INSTANCE) as MutableMap<*, *>
permissions.remove(plugin.parentPermission.id)
permissions.remove(plugin.parentPermission.id.run { "$namespace.$name" })
} catch (_: Exception) {
//
} catch (cause: Exception) {
logger.warning({ "jvm plugin $id permission remove exception." }, cause)
}
runInterruptible(Dispatchers.IO) {
classLoader.close()
try {
runInterruptible(Dispatchers.IO) {
classLoader.close()
}
} catch (cause: Exception) {
logger.warning({ "jvm plugin $id class loader close exception." }, cause)
}
cache.remove(jar)
loader.classLoaders.remove(classLoader)
Expand Down

0 comments on commit 01a6e38

Please sign in to comment.