From a4df5ddee7002845b9591932aa032d8d79966beb Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 4 Oct 2018 01:45:11 -0400 Subject: [PATCH] Report errors correctly from FutureTasks Anything that posts something to main thread was not correctly reporting their errors to the logger, passing the ExecutionExcetion instead of the cause. This resolves that, as well as patches some simple cases of System.nanoTime where mojang had used a LongSupplier to use a different method on client. --- Spigot-Server-Patches/0004-MC-Utils.patch | 49 ++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/Spigot-Server-Patches/0004-MC-Utils.patch b/Spigot-Server-Patches/0004-MC-Utils.patch index 2bbfa651c..bcd29b2ae 100644 --- a/Spigot-Server-Patches/0004-MC-Utils.patch +++ b/Spigot-Server-Patches/0004-MC-Utils.patch @@ -1,4 +1,4 @@ -From 056171fe4ced36a78f0f52df367876fcf6598101 Mon Sep 17 00:00:00 2001 +From 9c41b033695b2ef0aaa8f9ba1f6fe6abe50ceb50 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 28 Mar 2016 20:55:47 -0400 Subject: [PATCH] MC Utils @@ -796,6 +796,53 @@ index a21006290c..6c6f006f3a 100644 public int a() { return this.b.size(); } +diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java +index 1f1cb6a1b2..ced573d7fb 100644 +--- a/src/main/java/net/minecraft/server/SystemUtils.java ++++ b/src/main/java/net/minecraft/server/SystemUtils.java +@@ -34,8 +34,8 @@ public class SystemUtils { + return Collectors.toMap(Entry::getKey, Entry::getValue); + } + +- public static > String a(IBlockState iblockstate, Object object) { +- return iblockstate.a((Comparable)object); ++ public static > String a(IBlockState iblockstate, T object) { // Paper - decompile fix ++ return iblockstate.a(object); // Paper - decompile fix + } + + public static String a(String s, @Nullable MinecraftKey minecraftkey) { +@@ -43,11 +43,11 @@ public class SystemUtils { + } + + public static long b() { +- return c() / 1000000L; ++ return System.nanoTime() / 1000000L; // Paper + } + + public static long c() { +- return a.getAsLong(); ++ return System.nanoTime(); // Paper + } + + public static long d() { +@@ -109,7 +109,7 @@ public class SystemUtils { + futuretask.run(); + return (V)futuretask.get(); + } catch (ExecutionException executionexception) { +- logger.fatal("Error executing task", executionexception); ++ logger.fatal("Error executing task", executionexception.getCause() != null ? executionexception.getCause() : executionexception); // Paper + } catch (InterruptedException interruptedexception) { + logger.fatal("Error executing task", interruptedexception); + } +@@ -169,7 +169,7 @@ public class SystemUtils { + } + + public static Strategy g() { +- return SystemUtils.IdentityHashingStrategy.INSTANCE; ++ return (Strategy) IdentityHashingStrategy.INSTANCE; // Paper - decompile fix + } + + static enum IdentityHashingStrategy implements Strategy { -- 2.19.0