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

Yaml.createYamlDump(Enum).dump().toString() produces StackOverflowError #578

Open
CuteLuoBo opened this issue Aug 21, 2023 · 4 comments
Open

Comments

@CuteLuoBo
Copy link

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)
@zoeself
Copy link
Collaborator

zoeself commented Aug 21, 2023

@CuteLuoBo thank you for reporting this. I'll assign someone to take care of it soon.

@zoeself
Copy link
Collaborator

zoeself commented Aug 21, 2023

@amihaiemil I couldn't find any assignee for this task. This is either because there are no contributors with role DEV available or because the project does not have enough funds.

Please, make sure there is at least one available contributor with the required role and the project can afford to pay them.

2 similar comments
@zoeself
Copy link
Collaborator

zoeself commented Feb 23, 2024

@amihaiemil I couldn't find any assignee for this task. This is either because there are no contributors with role DEV available or because the project does not have enough funds.

Please, make sure there is at least one available contributor with the required role and the project can afford to pay them.

@zoeself
Copy link
Collaborator

zoeself commented Mar 3, 2025

@amihaiemil I couldn't find any assignee for this task. This is either because there are no contributors with role DEV available or because the project does not have enough funds.

Please, make sure there is at least one available contributor with the required role and the project can afford to pay them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants