Closed uiytt closed 4 years ago
Hey uiytt,
Thank you so much for reporting this issue and describing it so highly detailed. We really appreciate it and it really helps me:)
We've already started figuring it out but it seems very weird. We will try to fix it soon & push this fix to the next release.
However, until then you could just use a List instead of an array. We don't know why but we know that this issue doesn't exist with a list instead of an array. You could use the following code:
Yaml YamlConfig = new Yaml("config","storagetest");
String [] defaulteffect = {"test1","test2","test3"};
System.out.println(YamlConfig.getOrSetDefault("test", Arrays.asList(defaulteffect)).getClass());
Regards
Hey uiytt,
The issue was resolved in the newest version: 3.0.2
Thanks for reporting it.
Regards,
Please try updating to 3.0.3
Describe the bug When trying to get a list from a yaml file (or any other file like Json), the first time it returns a string with no error, the second time : an error.
To Reproduce Use this code :
First time the output is : "class [Ljava.lang.String;" second time : "java.lang.ClassCastException: java.util.ArrayList cannot be cast to [Ljava.lang.String;" Expected behavior Return a String[] containing "test1","test2" and "test3"