aboutsummaryrefslogtreecommitdiff
path: root/spark-bukkit/src
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2019-05-15 17:02:27 +0100
committerLuck <git@lucko.me>2019-05-15 17:02:27 +0100
commitaaa03b1cde9595afacfecd1a24e4540eda40a02a (patch)
tree102b563a08b8d2238fe3d235067d17c1ec45819c /spark-bukkit/src
parent5d52a42508bb6d3e8ada40ff65746301fd42a4a4 (diff)
downloadspark-aaa03b1cde9595afacfecd1a24e4540eda40a02a.tar.gz
spark-aaa03b1cde9595afacfecd1a24e4540eda40a02a.tar.bz2
spark-aaa03b1cde9595afacfecd1a24e4540eda40a02a.zip
Add try..catch around the parsing of each heap dump summary entry
Diffstat (limited to 'spark-bukkit/src')
-rw-r--r--spark-bukkit/src/main/java/me/lucko/spark/bukkit/CommandMapUtil.java32
1 files changed, 8 insertions, 24 deletions
diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/CommandMapUtil.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/CommandMapUtil.java
index 08d65df..66a1568 100644
--- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/CommandMapUtil.java
+++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/CommandMapUtil.java
@@ -51,32 +51,16 @@ public final class CommandMapUtil {
private static final Field KNOWN_COMMANDS_FIELD;
static {
- Constructor<PluginCommand> commandConstructor;
try {
- commandConstructor = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);
- commandConstructor.setAccessible(true);
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(e);
+ COMMAND_CONSTRUCTOR = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);
+ COMMAND_CONSTRUCTOR.setAccessible(true);
+ COMMAND_MAP_FIELD = SimplePluginManager.class.getDeclaredField("commandMap");
+ COMMAND_MAP_FIELD.setAccessible(true);
+ KNOWN_COMMANDS_FIELD = SimpleCommandMap.class.getDeclaredField("knownCommands");
+ KNOWN_COMMANDS_FIELD.setAccessible(true);
+ } catch (NoSuchMethodException | NoSuchFieldException e) {
+ throw new ExceptionInInitializerError(e);
}
- COMMAND_CONSTRUCTOR = commandConstructor;
-
- Field commandMapField;
- try {
- commandMapField = SimplePluginManager.class.getDeclaredField("commandMap");
- commandMapField.setAccessible(true);
- } catch (NoSuchFieldException e) {
- throw new RuntimeException(e);
- }
- COMMAND_MAP_FIELD = commandMapField;
-
- Field knownCommandsField;
- try {
- knownCommandsField = SimpleCommandMap.class.getDeclaredField("knownCommands");
- knownCommandsField.setAccessible(true);
- } catch (NoSuchFieldException e) {
- throw new RuntimeException(e);
- }
- KNOWN_COMMANDS_FIELD = knownCommandsField;
}
private static CommandMap getCommandMap() {