From 1c384362669bd7636dfa341bcabdf7a523e287c9 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/0009-Timings-v2.patch | 22 +++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Spigot-Server-Patches/0009-Timings-v2.patch b/Spigot-Server-Patches/0009-Timings-v2.patch index 114dbe343d..50008e119d 100644 --- a/Spigot-Server-Patches/0009-Timings-v2.patch +++ b/Spigot-Server-Patches/0009-Timings-v2.patch @@ -1,4 +1,4 @@ -From 4c63953c6c9a33d2b257fc8fcd781e6291181aba Mon Sep 17 00:00:00 2001 +From 4940966a47053eee781a2859090f7b1d6f381b42 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 3 Mar 2016 04:00:11 -0600 Subject: [PATCH] Timings v2 @@ -6,10 +6,10 @@ 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 +1,135 @@ +@@ -0,0 +1,141 @@ +package co.aikar.timings; + +import com.google.common.collect.MapMaker; @@ -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); @@ -1837,5 +1843,5 @@ index ca7789b5e..442383969 100644 } } -- -2.24.0 +2.24.1