After passing the enumeration class into the Yaml.createYamlDump(Object).dump() method, calling YamlNode.toString() will cause a StackOverflowError
Usage version
eo-yaml 7.0.9
jdk 11
How i found out
My JavaBean contains enumeration properties. When I directly call this method to get the YamlNode, this error occurred. After troubleshooting, I finally found out that the problem was caused by the enumeration passed in. Currently I solved it by implementing additional logic.
How to reproduce
@Test
public void debug() {
YamlNode node = Yaml.createYamlDump(TimeUnit.DAYS).dump();
System.out.println(node);
}
Crash log
java.lang.StackOverflowError
at java.base/java.util.regex.Pattern.clazz(Pattern.java:2701)
at java.base/java.util.regex.Pattern.sequence(Pattern.java:2126)
at java.base/java.util.regex.Pattern.expr(Pattern.java:2056)
at java.base/java.util.regex.Pattern.compile(Pattern.java:1778)
at java.base/java.util.regex.Pattern.<init>(Pattern.java:1427)
at java.base/java.util.regex.Pattern.compile(Pattern.java:1068)
at java.base/java.util.regex.Pattern.matches(Pattern.java:1173)
at java.base/java.lang.String.matches(String.java:2024)
at com.amihaiemil.eoyaml.RtYamlPrinter$Escaped.value(RtYamlPrinter.java:395)
at com.amihaiemil.eoyaml.RtYamlPrinter.printMapping(RtYamlPrinter.java:142)
at com.amihaiemil.eoyaml.RtYamlPrinter.printNode(RtYamlPrinter.java:295)
at com.amihaiemil.eoyaml.RtYamlPrinter.printSequence(RtYamlPrinter.java:194)
at com.amihaiemil.eoyaml.RtYamlPrinter.printNode(RtYamlPrinter.java:293)
at com.amihaiemil.eoyaml.RtYamlPrinter.printMapping(RtYamlPrinter.java:159)
at com.amihaiemil.eoyaml.RtYamlPrinter.printNode(RtYamlPrinter.java:295)
at com.amihaiemil.eoyaml.RtYamlPrinter.printSequence(RtYamlPrinter.java:194)
...
at com.amihaiemil.eoyaml.RtYamlPrinter.printMapping(RtYamlPrinter.java:159)
at com.amihaiemil.eoyaml.RtYamlPrinter.printNode(RtYamlPrinter.java:295)
at com.amihaiemil.eoyaml.RtYamlPrinter.printSequence(RtYamlPrinter.java:194)
After passing the enumeration class into the Yaml.createYamlDump(Object).dump() method, calling YamlNode.toString() will cause a StackOverflowError
Usage version
eo-yaml 7.0.9
jdk 11
How i found out
My JavaBean contains enumeration properties. When I directly call this method to get the YamlNode, this error occurred. After troubleshooting, I finally found out that the problem was caused by the enumeration passed in. Currently I solved it by implementing additional logic.
How to reproduce
Crash log