[SPIGOT-5881] SnakeYaml 1.26 limits non-scalar (null) nodes while 1.25 does not [1.16.1] Created: 28/Jun/20  Updated: 28/Jun/20  Resolved: 28/Jun/20

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: Thonk Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: request

Attachments: File BugPlugin-1.0.0.jar    
Version: This server is running CraftBukkit version git-Spigot-ad703da-d77f4d9 (MC: 1.16.1) (Implementing API version 1.16.1-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

Any null node in SnakeYaml is considered non-scalar and gets added to a count that has a limit of 50, so if you serialize a mostly empty doublechest inventory and later try and load it, a YAMLException will be called and you'll be returned with an empty YamlConfiguration. Wondering if a constructor could be added to YamlConfiguration that accepts a Yaml object so we can make our own implementation or if the limit of 50 in LoaderOptions could be raised.

 

https://www.javadoc.io/doc/org.yaml/snakeyaml/1.26/org/yaml/snakeyaml/LoaderOptions.html



 Comments   
Comment by Thonk [ 28/Jun/20 ]

Interesting, thanks!

Comment by md_5 [ 28/Jun/20 ]

I acknowledge this is a change of behaviour so we may have to disable the limit; however you are only seeing it because your code is broken — you are calling .serialize directly rather than just .set item

Comment by Thonk [ 28/Jun/20 ]

yes, my bad I made a test case but forgot to upload it. I have attached it now

 error is here https://paste.gg/p/anonymous/05dec5b891ff4655b765ffe3c4878d7a

you can replicate it by adding a couple stacks of items to your inventory and then running /testplugin serialize and then /testplugin load and it will cause the exception above. If you add enough item stacks so that the amount of null slots is below 50 it will load the configuration file properly and not cause an error.

Comment by md_5 [ 28/Jun/20 ]

What’s the exception?

do you have a test case?

Generated at Fri Mar 21 18:22:20 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.