From 5ea670d028b20eedca0b804e43e8bc2ef80105bd Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sun, 15 Dec 2019 22:39:25 +0000 Subject: [PATCH] attempt to allow timings to continue with janky plugin classes --- Spigot-Server-Patches/Timings-v2.patch | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Spigot-Server-Patches/Timings-v2.patch b/Spigot-Server-Patches/Timings-v2.patch index 42f29bb993..ada544a86a 100644 --- a/Spigot-Server-Patches/Timings-v2.patch +++ b/Spigot-Server-Patches/Timings-v2.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Timings v2 diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java new file mode 100644 -index 000000000..c6818bc86 +index 000000000..69e26a826 --- /dev/null +++ b/src/main/java/co/aikar/timings/MinecraftTimings.java @@ -0,0 +0,0 @@ @@ -79,10 +79,16 @@ index 000000000..c6818bc86 + plugin = TimingsManager.getPluginByClassloader(taskClass); + } + -+ final String taskname = taskNameCache.computeIfAbsent(taskClass, clazz -> -+ clazz.isAnonymousClass() || clazz.isLocalClass() -+ ? clazz.getName() -+ : clazz.getCanonicalName()); ++ final String taskname = taskNameCache.computeIfAbsent(taskClass, clazz -> { ++ try { ++ return clazz.isAnonymousClass() || clazz.isLocalClass() ++ ? clazz.getName() ++ : clazz.getCanonicalName(); ++ } catch (Throwable ex) { ++ new Exception("Error occurred detecting class name", ex).printStackTrace(); ++ return "MangledClassFile"; ++ } ++ }); + + StringBuilder name = new StringBuilder(64); + name.append("Task: ").append(taskname);