RecipeManager

RecipeManager

130k Downloads

NullPointerException on startup in `Files.createNameIndex()` effectively disables plugin

totemo opened this issue · 5 comments

commented

Affected RecipeManager versions: v2.17.1 and v.2.17.2 (current release)
Server version: PaperSpigot 172 and PaperSpigot 186 (latest):

NPE happens when trying to create default configuration, and apparently the unhandled exception is enough to prevent the plugin from supporting our one and only recipe when we try to add that after a restart.

Stack trace:

2019-09-04 08:00:40 [INFO] [RecipeManager] Parsed 0 recipe books.
2019-09-04 08:00:40 [INFO] [RecipeManager] §aGenerated 'messages.yml' file.
2019-09-04 08:00:40 [INFO] [RecipeManager] §aGenerated 'recipe flags.html' file.
2019-09-04 08:00:40 [INFO] [RecipeManager] §aGenerated 'commands & permissions.html' file.
2019-09-04 08:00:40 [WARN] Task #69 for RecipeManager v2.17.2 generated an exception
java.lang.NullPointerException: null
        at haveric.recipeManager.Files.createNameIndex(Files.java:519) ~[?:?]
        at haveric.recipeManager.Files.<init>(Files.java:82) ~[?:?]
        at haveric.recipeManager.Files.reload(Files.java:70) ~[?:?]
        at haveric.recipeManager.RecipeManager.reload(RecipeManager.java:180) ~[?:?]
        at haveric.recipeManager.RecipeManager.onEnablePost(RecipeManager.java:127) ~[?:?]
        at haveric.recipeManager.RecipeManager.access$000(RecipeManager.java:42) ~[?:?]
        at haveric.recipeManager.RecipeManager$1.run(RecipeManager.java:106) ~[?:?]
        at org.bukkit.craftbukkit.v1_14_R1.scheduler.CraftTask.run(CraftTask.java:84) ~[patched_1.14.4.jar:git-Paper-186]
        at org.bukkit.craftbukkit.v1_14_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:452) ~[patched_1.14.4.jar:git-Paper-186]
        at net.minecraft.server.v1_14_R1.MinecraftServer.b(MinecraftServer.java:1148) ~[patched_1.14.4.jar:git-Paper-186]
        at net.minecraft.server.v1_14_R1.DedicatedServer.b(DedicatedServer.java:417) ~[patched_1.14.4.jar:git-Paper-186]
        at net.minecraft.server.v1_14_R1.MinecraftServer.a(MinecraftServer.java:1075) ~[patched_1.14.4.jar:git-Paper-186]
        at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:919) ~[patched_1.14.4.jar:git-Paper-186]
        at java.lang.Thread.run(Thread.java:835) [?:?]

The recipe, though as noted this doesn't come into play. The exception happens when the plugin is creating its configuration files on first run.

CRAFT heart_of_the_sea
cyan_dye + cyan_dye + cyan_dye
cyan_dye + air + cyan_dye
cyan_dye + cyan_dye + cyan_dye
= heart_of_the_sea
@ingredientcondition cyan_dye | name &3Glistening Heart Fragment | enchant arrow_infinite 1
commented

Thanks, that's perfect.

commented

I'm unable to replicate this. Do you have any other plugins (or datapacks) enabled, specifically any that would add Enchantments?

commented

Oh! One of our plugins does indeed add a custom enchantment. It has, however been doing that for few years now and we have been running RecipeManager successfully in that time period as well.

commented

Looking further at it, I can see that the EnchantmentTarget is null. I'm due to do some maintenance on that plugin soon. Thanks for the pointer.

commented

Ah, good to hear. It looks like there was a check in place for the 1.12 and older path for an empty EnchantmentTarget so it must be fairly new. I'll add an extra check on the 1.13+ side just in case though, which should get added to the next release.