catch IAE from empty transformation builder

This commit is contained in:
Jake Potrebic 2022-06-09 13:06:03 -07:00
parent d9fcf39f65
commit f27aa33aba
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5
4 changed files with 16 additions and 10 deletions

View File

@ -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

View File

@ -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<GlobalConfiguration, Wor
@@ -333,6 +334,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
private static final Map<String, Command> COMMANDS = new HashMap<>();
static {

View File

@ -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<GlobalConfiguration, Wor
@@ -333,6 +334,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
}
private static final Map<String, Command> 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<GlobalConfiguration, Wor
@@ -341,6 +343,11 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
COMMANDS.forEach((s, command) -> {
server.server.getCommandMap().register(s, "Paper", command);
});

View File

@ -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<GlobalConfiguration, Wor
@@ -339,6 +340,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
private static boolean metricsStarted = false;
static {
COMMANDS.put("paper", new PaperCommand("paper"));