Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Material#createBlockData throws an internal NullPointerException

Open TheLimeGlass opened this issue 1 year ago • 3 comments

Stack trace

[23:14:37 WARN]: java.lang.NullPointerException
[23:14:37 WARN]:        at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1693)
[23:14:37 WARN]:        at org.bukkit.craftbukkit.block.data.CraftBlockData.newData(CraftBlockData.java:568)
[23:14:37 WARN]:        at org.bukkit.craftbukkit.CraftServer.createBlockData(CraftServer.java:2814)
[23:14:37 WARN]:        at org.bukkit.craftbukkit.CraftServer.createBlockData(CraftServer.java:2789)
[23:14:37 WARN]:        at org.bukkit.Bukkit.createBlockData(Bukkit.java:2439)
[23:14:37 WARN]:        at org.bukkit.Material.createBlockData(Material.java:4800)

Plugin and Datapack List

FastAsyncWorldEdit, LuckPerms

Actions to reproduce (if known)

val materials = Material.entries.map { it.createBlockData().asString }

Paper version

1.21.1-52

Other

Spigot or Paper is calling ConcurrentHashMap#get(null)

The method should be throwing IllegalArgumentException and not NullPointerException when the specified data is not valid, as stated by the javadoc.

Placing the map lambda into an ignore try catch solves the issue.

TheLimeGlass avatar Nov 26 '24 23:11 TheLimeGlass

Hi @TheLimeGlass, I want to contribute to this issue could you please assign it to me ?

Karim-Ashraf1 avatar Nov 30 '24 08:11 Karim-Ashraf1

Hi @TheLimeGlass, I want to contribute to this issue could you please assign it to me ?

You can just open a PR to it, you don't need to have it assigned. You are free to fix this, but if you don't want to anymore, I'd be glad to take over

Strokkur424 avatar Nov 30 '24 15:11 Strokkur424

Hi @TheLimeGlass, I want to contribute to this issue could you please assign it to me ?

You can just open a PR to it, you don't need to have it assigned. You are free to fix this, but if you don't want to anymore, I'd be glad to take over

Thanks @Strokkur424, We can tackle it together if that would interest you.

Karim-Ashraf1 avatar Nov 30 '24 16:11 Karim-Ashraf1