NPE on config initialization - can't load saved marker file, if id contains a slash
Prof-Bloodstone opened this issue ยท 5 comments
Issue Description:
Dynmap saves configuration just fine, but it might fail to load it and throw NPE.
It looks like the culprit is here: https://github.com/webbukkit/dynmap/blob/v3.0/DynmapCore/src/main/java/org/dynmap/markers/impl/MarkerSetImpl.java#L469
for(String id : areamarkernode.keySet()) {
AreaMarkerImpl marker = new AreaMarkerImpl(id, this); /* Make and load marker */
if(marker.loadPersistentData(areamarkernode.getNode(id))) { // BUG: .getNode(id) returns null
In my case it was cause by the area ID containing a /
character.
- Dynmap Version: dynmap v3.1-beta3a-409
- Server Version: Paper 1.16.2 build 185
- Pastebin of crashlogs or other relevant logs:
Are marker:
[10:14:53] [Server thread/INFO]: [dynmap] Enabling dynmap v3.1-beta3a-409*
[10:14:53] [Server thread/INFO]: [dynmap] Added 4 custom biome mappings
[10:14:53] [Server thread/INFO]: [dynmap] Using LuckPerms 5.1.66 for access control
[10:14:53] [Server thread/ERROR]: Error occurred while enabling dynmap v3.1-beta3a-409 (Is it up to date?)
java.lang.NullPointerException: null
at org.dynmap.markers.impl.AreaMarkerImpl.loadPersistentData(AreaMarkerImpl.java:122) ~[?:?]
at org.dynmap.markers.impl.MarkerSetImpl.loadPersistentData(MarkerSetImpl.java:471) ~[?:?]
at org.dynmap.markers.impl.MarkerAPIImpl.loadMarkers(MarkerAPIImpl.java:717) ~[?:?]
at org.dynmap.markers.impl.MarkerAPIImpl.initializeMarkerAPI(MarkerAPIImpl.java:384) ~[?:?]
at org.dynmap.DynmapCore.initConfiguration(DynmapCore.java:410) ~[?:?]
at org.dynmap.bukkit.DynmapPlugin.onEnable(DynmapPlugin.java:905) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.2.jar:git-Paper-185]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.16.2.jar:git-Paper-185]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.16.2.jar:git-Paper-185]
at org.bukkit.craftbukkit.v1_16_R2.CraftServer.enablePlugin(CraftServer.java:499) ~[patched_1.16.2.jar:git-Paper-185]
at org.bukkit.craftbukkit.v1_16_R2.CraftServer.enablePlugins(CraftServer.java:413) ~[patched_1.16.2.jar:git-Paper-185]
at net.minecraft.server.v1_16_R2.MinecraftServer.loadWorld(MinecraftServer.java:468) ~[patched_1.16.2.jar:git-Paper-185]
at net.minecraft.server.v1_16_R2.DedicatedServer.init(DedicatedServer.java:241) ~[patched_1.16.2.jar:git-Paper-185]
at net.minecraft.server.v1_16_R2.MinecraftServer.w(MinecraftServer.java:939) ~[patched_1.16.2.jar:git-Paper-185]
at net.minecraft.server.v1_16_R2.MinecraftServer.lambda$a$0(MinecraftServer.java:177) ~[patched_1.16.2.jar:git-Paper-185]
at java.lang.Thread.run(Unknown Source) [?:?]
Circle:
[15:08:36 INFO]: [dynmap] Enabling dynmap v3.1-beta3a-409*
[15:08:37 INFO]: [dynmap] Added 4 custom biome mappings
[15:08:37 INFO]: [dynmap] Using Bukkit Permissions (superperms) for access control
[15:08:37 INFO]: [dynmap] Web interface permissions only available for online users
[15:08:38 ERROR]: Error occurred while enabling dynmap v3.1-beta3a-409 (Is it up to date?)
java.lang.NullPointerException: null
at org.dynmap.markers.impl.CircleMarkerImpl.loadPersistentData(CircleMarkerImpl.java:104) ~[?:?]
at org.dynmap.markers.impl.MarkerSetImpl.loadPersistentData(MarkerSetImpl.java:509) ~[?:?]
at org.dynmap.markers.impl.MarkerAPIImpl.loadMarkers(MarkerAPIImpl.java:717) ~[?:?]
at org.dynmap.markers.impl.MarkerAPIImpl.initializeMarkerAPI(MarkerAPIImpl.java:384) ~[?:?]
at org.dynmap.DynmapCore.initConfiguration(DynmapCore.java:410) ~[?:?]
at org.dynmap.bukkit.DynmapPlugin.onEnable(DynmapPlugin.java:905) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.2.jar:git-Paper-185]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.16.2.jar:git-Paper-185]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.16.2.jar:git-Paper-185]
at org.bukkit.craftbukkit.v1_16_R2.CraftServer.enablePlugin(CraftServer.java:499) ~[patched_1.16.2.jar:git-Paper-185]
at org.bukkit.craftbukkit.v1_16_R2.CraftServer.enablePlugins(CraftServer.java:413) ~[patched_1.16.2.jar:git-Paper-185]
at net.minecraft.server.v1_16_R2.MinecraftServer.loadWorld(MinecraftServer.java:468) ~[patched_1.16.2.jar:git-Paper-185]
at net.minecraft.server.v1_16_R2.DedicatedServer.init(DedicatedServer.java:241) ~[patched_1.16.2.jar:git-Paper-185]
at net.minecraft.server.v1_16_R2.MinecraftServer.w(MinecraftServer.java:939) ~[patched_1.16.2.jar:git-Paper-185]
at net.minecraft.server.v1_16_R2.MinecraftServer.lambda$a$0(MinecraftServer.java:177) ~[patched_1.16.2.jar:git-Paper-185]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_262]
- Other Relevant Data/Screenshots: Nothing
- Steps to Replicate:
- Start fresh server, with new dynmap.
- Run:
/dmarker addcircle id:prof/bloodstone
- Stop the server
- Start the server and observer errors being thrown in dynmap onEnable
[X] I have looked at all other issues and this is not a duplicate
[X] I have been able to replicate this
This is still an issue:
> dmarker addcircle a/b id:a/b x:0 y:0 z:0 world:world
[18:52:43 INFO]: Added circle id:'a/b' (a/b) to set 'markers'
> dynmap version
[18:53:22 INFO]: Dynmap version: core=3.2-beta-3-512, plugin=3.2-beta-3-512
After restart:
[18:53:36 INFO]: [dynmap] Enabling dynmap v3.2-beta-3-512
[18:53:36 INFO]: [dynmap] Added 2 custom biome mappings
[18:53:36 INFO]: [dynmap] Using Bukkit Permissions (superperms) for access control
[18:53:36 INFO]: [dynmap] Web interface permissions only available for online users
[18:53:36 ERROR]: Error occurred while enabling dynmap v3.2-beta-3-512 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.dynmap.ConfigurationNode.getString(String, String)" because "node" is null
at org.dynmap.markers.impl.CircleMarkerImpl.loadPersistentData(CircleMarkerImpl.java:104) ~[dynmap.jar:?]
at org.dynmap.markers.impl.MarkerSetImpl.loadPersistentData(MarkerSetImpl.java:509) ~[dynmap.jar:?]
at org.dynmap.markers.impl.MarkerAPIImpl.loadMarkers(MarkerAPIImpl.java:717) ~[dynmap.jar:?]
at org.dynmap.markers.impl.MarkerAPIImpl.initializeMarkerAPI(MarkerAPIImpl.java:384) ~[dynmap.jar:?]
at org.dynmap.DynmapCore.initConfiguration(DynmapCore.java:439) ~[dynmap.jar:?]
at org.dynmap.bukkit.DynmapPlugin.onEnable(DynmapPlugin.java:932) ~[dynmap.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.17.1.jar:git-Paper-196]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.17.1.jar:git-Paper-196]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.17.1.jar:git-Paper-196]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:529) ~[patched_1.17.1.jar:git-Paper-196]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:443) ~[patched_1.17.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:639) ~[patched_1.17.1.jar:git-Paper-196]
at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:306) ~[patched_1.17.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1126) ~[patched_1.17.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[patched_1.17.1.jar:git-Paper-196]
at java.lang.Thread.run(Thread.java:831) [?:?]
[18:53:36 INFO]: [dynmap] Disabling dynmap v3.2-beta-3-512
[18:53:36 INFO]: [dynmap] Unloaded 0 components.
[18:53:36 INFO]: [dynmap] Disabled
Latest dynmap v3.2-beta-3-512
and Paper git-Paper-196 (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT) (Git: 59d449d)
Assuming this is fixed in a later release or otherwise no longer relevant- please reply so I can reopen if this persists.
Just kidding. Its fixed on 3.3beta3 at least:
%YAML 1.1
---
icons:
monkey:
label: monkey
sets:
markers:
hide: false
circles:
prof/bloodstone:
markup: false
fillOpacity: 0.35
strokeWeight: 3
label: prof/bloodstone
fillColor: 16711680
world: world
x: 100.0
zr: 1.0
y: 85.0
z: 100.0
xr: 1.0
strokeColor: 16711680
strokeOpacity: 0.8
deficon: default
areas: {
}
label: Markers
markers:
monkey:
world: world
markup: false
x: 4.0
icon: monkey
y: 85.0
z: 5.0
label: monkey
test/marker:
world: world
markup: false
x: 100.0
icon: house
y: 85.0
z: 100.0
label: test/marker
lines: {
}
layerprio: 0
playersets: {
}
No errors in console
[10:03:05 INFO]: [dynmap] Enabling dynmap v3.3-beta-3-591
[10:03:05 INFO]: [dynmap] Added 18 custom biome mappings
[10:03:05 INFO]: [dynmap] Using Bukkit Permissions (superperms) for access control
[10:03:05 INFO]: [dynmap] Web interface permissions only available for online users
[10:03:05 INFO]: [dynmap] Mod Support processing completed
[10:03:06 INFO]: [dynmap] Loaded 25 shaders.
[10:03:06 INFO]: [dynmap] Loaded 82 perspectives.
[10:03:06 INFO]: [dynmap] Loaded 22 lightings.
[10:03:06 INFO]: [dynmap] Starting enter/exit processing
[10:03:06 INFO]: [dynmap] Finish marker initialization
[10:03:06 INFO]: [dynmap] Web server started on address 0.0.0.0:8123
[10:03:06 INFO]: [dynmap] version 3.3-beta-3-591 is enabled - core version 3.3-beta-3-591
[10:03:06 INFO]: [dynmap] For support, visit https://reddit.com/r/Dynmap or our Discord at https://discord.gg/s3rd5qn
[10:03:06 INFO]: [dynmap] To report or track bugs, visit https://github.com/webbukkit/dynmap/issues
[10:03:06 INFO]: [dynmap] If you'd like to donate, please visit https://www.patreon.com/dynmap or https://ko-fi.com/michaelprimm
[10:03:06 INFO]: [dynmap] Loaded 3 maps of world 'world'.
[10:03:06 INFO]: [dynmap] Loaded 2 maps of world 'world_nether'.
[10:03:06 INFO]: [dynmap] Loaded 2 maps of world 'world_the_end'.
[10:03:06 INFO]: [dynmap] Enabled
[10:03:06 INFO]: Running delayed init tasks
[10:03:06 INFO]: Done (2.790s)! For help, type "help"
And the marker does show up on the map:
I'll re-mark this as fixed and close. Nice catch @JurgenKuyper
checked in latest dynmap version (3.3-beta-4-617) no longer the case, please re-open if still the issue