From f27aa33abae62af4f70aeae2dd8e3cf474407eec Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Thu, 9 Jun 2022 13:06:03 -0700 Subject: [PATCH] catch IAE from empty transformation builder --- patches/server/0004-Paper-config-files.patch | 12 +++++++++--- patches/server/0009-Paper-command.patch | 4 ++-- patches/server/0011-Paper-Metrics.patch | 6 +++--- .../0373-Add-tick-times-API-and-mspt-command.patch | 4 ++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/patches/server/0004-Paper-config-files.patch b/patches/server/0004-Paper-config-files.patch index 088f72113f..078373cd39 100644 --- a/patches/server/0004-Paper-config-files.patch +++ b/patches/server/0004-Paper-config-files.patch @@ -835,10 +835,10 @@ index 0000000000000000000000000000000000000000..69add4a7f1147015806bc9b63a8340d1 +} diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java new file mode 100644 -index 0000000000000000000000000000000000000000..5069e55e46b628dc0fdaccbfc279033f60924eb8 +index 0000000000000000000000000000000000000000..4ee18a87d3160ef41654116f033a01f2e52513f2 --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -@@ -0,0 +1,369 @@ +@@ -0,0 +1,375 @@ +package io.papermc.paper.configuration; + +import com.google.common.base.Suppliers; @@ -1056,7 +1056,13 @@ index 0000000000000000000000000000000000000000..5069e55e46b628dc0fdaccbfc279033f + // ADD FUTURE TRANSFORMS HERE (these transforms run after the defaults have been merged into the node) + DEFAULT_AWARE_TRANSFORMATIONS.forEach(transform -> transform.apply(builder, contextMap, defaultsNode)); + -+ builder.build().apply(worldNode); ++ ConfigurationTransformation transformation; ++ try { ++ transformation = builder.build(); // build throws IAE if no actions were provided (bad zml) ++ } catch (IllegalArgumentException ignored) { ++ return; ++ } ++ transformation.apply(worldNode); + } + + @Override diff --git a/patches/server/0009-Paper-command.patch b/patches/server/0009-Paper-command.patch index 7b534538cf..3f29b13d49 100644 --- a/patches/server/0009-Paper-command.patch +++ b/patches/server/0009-Paper-command.patch @@ -297,7 +297,7 @@ index 0000000000000000000000000000000000000000..e75134a6aa92c86aa86430c7603e1112 + } +} diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -index 5069e55e46b628dc0fdaccbfc279033f60924eb8..41b332f878810df0611137be79e7dd1a3372ec00 100644 +index 4ee18a87d3160ef41654116f033a01f2e52513f2..093c157034cb6e245a6cc0a23ded073f05b6bb3c 100644 --- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java @@ -1,5 +1,6 @@ @@ -307,7 +307,7 @@ index 5069e55e46b628dc0fdaccbfc279033f60924eb8..41b332f878810df0611137be79e7dd1a import com.google.common.base.Suppliers; import com.google.common.collect.Table; import com.mojang.logging.LogUtils; -@@ -327,6 +328,7 @@ public class PaperConfigurations extends Configurations COMMANDS = new HashMap<>(); static { diff --git a/patches/server/0011-Paper-Metrics.patch b/patches/server/0011-Paper-Metrics.patch index 260a4aea8d..0101bdee94 100644 --- a/patches/server/0011-Paper-Metrics.patch +++ b/patches/server/0011-Paper-Metrics.patch @@ -690,7 +690,7 @@ index 0000000000000000000000000000000000000000..5a19e30a9b7e65a70f68a429b8ca741f + } +} diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -index 41b332f878810df0611137be79e7dd1a3372ec00..b49e7949337517dcf1dd0738b3f8573a04efcae5 100644 +index 093c157034cb6e245a6cc0a23ded073f05b6bb3c..6b4635bf556fe966a835a0ba741fbe3fa0083d9a 100644 --- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java @@ -1,5 +1,6 @@ @@ -700,7 +700,7 @@ index 41b332f878810df0611137be79e7dd1a3372ec00..b49e7949337517dcf1dd0738b3f8573a import com.destroystokyo.paper.PaperCommand; import com.google.common.base.Suppliers; import com.google.common.collect.Table; -@@ -327,6 +328,7 @@ public class PaperConfigurations extends Configurations COMMANDS = new HashMap<>(); @@ -708,7 +708,7 @@ index 41b332f878810df0611137be79e7dd1a3372ec00..b49e7949337517dcf1dd0738b3f8573a static { COMMANDS.put("paper", new PaperCommand("paper")); } -@@ -335,6 +337,11 @@ public class PaperConfigurations extends Configurations { server.server.getCommandMap().register(s, "Paper", command); }); diff --git a/patches/server/0373-Add-tick-times-API-and-mspt-command.patch b/patches/server/0373-Add-tick-times-API-and-mspt-command.patch index dcd7832ca5..40cb4efbed 100644 --- a/patches/server/0373-Add-tick-times-API-and-mspt-command.patch +++ b/patches/server/0373-Add-tick-times-API-and-mspt-command.patch @@ -110,7 +110,7 @@ index 0000000000000000000000000000000000000000..874f0c2a071994c2145848886caa385e + } +} diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -index 0ee70d37ac22da84f671b688863ff691961ad652..339ff4962cf8f9f9b308245d8c8de2c5d31bf51a 100644 +index 6d945ae5a63464e43c4ca63ddbf5beb9b6042bca..0230bf8033ed8169085b69014b74737806041370 100644 --- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java @@ -1,5 +1,6 @@ @@ -120,7 +120,7 @@ index 0ee70d37ac22da84f671b688863ff691961ad652..339ff4962cf8f9f9b308245d8c8de2c5 import com.destroystokyo.paper.Metrics; import com.destroystokyo.paper.PaperCommand; import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray; -@@ -333,6 +334,7 @@ public class PaperConfigurations extends Configurations