Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexOutOfBoundsException when doing node.getValue(token, defaultInstance) #184

Closed
Eufranio opened this issue Dec 1, 2020 · 1 comment
Closed
Assignees
Milestone

Comments

@Eufranio
Copy link

Eufranio commented Dec 1, 2020

Recently (as of newer Sponge versions) my plugins started erroring on config initialization. I reproduced this on the latest version of SpongeVanilla.

Error: https://gist.github.com/Eufranio/619a4d50688a615c69658db2e74b0229
Config code: https://github.com/Eufranio/StorageUtils/blob/master/src/main/java/io/github/eufranio/config/Config.java#L40

@zml2008 zml2008 added the bug label Dec 2, 2020
@zml2008 zml2008 self-assigned this Dec 2, 2020
@zml2008 zml2008 added this to the 4.1 milestone Dec 2, 2020
@zml2008
Copy link
Member

zml2008 commented Dec 2, 2020

Thanks for reporting! This issue should be fixable for 4.1.

In the meantime on 3.7, you will have to work around the underlying issue, which is that in any node that isn't already a map (including uninitialized ones), an entry with an integer key is assumed to be an element of a list.

You can most likely work around this by initializing the appropriate nodes to an empty map before saving, using a non-integer type for the map keys (Long, Short, etc, or even String), or shipping a patched MapSerializer with your plugin and using a customized type serializer collection (applied in ConfigurationOptions).

@zml2008 zml2008 closed this as completed in c0083d0 Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants