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

Random java.lang.StackOverflowError #14

Open
GoogleCodeExporter opened this issue Dec 29, 2015 · 0 comments
Open

Random java.lang.StackOverflowError #14

GoogleCodeExporter opened this issue Dec 29, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

1. Run following code couple of times. Usually exception is thrown between 
first and tenth iteration:

import nl.flotsam.xeger.Xeger;

public class Test {
    public static void main(String[] args) {
        String pattern = "[\\w\\-.]+(@[a-zA-Z0-9.\\-]+\\.[a-zA-Z0-9]{2,})?";
        Xeger generator = new Xeger(pattern);
        for (int i = 0; i < 1000; i++) {
            System.out.println("iteration " + i);
            generator.generate();
        }
    }
}


What is the expected output?
String according to passed pattern.

What do you see instead?
java.lang.StackOverflowError

What version of the product are you using? On what operating system?
1.0, Red Hat Enterprise Linux Client release 5.4 (Tikanga)

Please provide any additional information below.

Output:

iteration 0
iteration 1
iteration 2
iteration 3
iteration 4
Exception in thread "main" java.lang.StackOverflowError
    at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:587)
    at java.lang.StringBuilder.append(StringBuilder.java:214)
    at nl.flotsam.xeger.Xeger.appendChoice(Xeger.java:85)
    at nl.flotsam.xeger.Xeger.generate(Xeger.java:79)
    at nl.flotsam.xeger.Xeger.generate(Xeger.java:80)
    at nl.flotsam.xeger.Xeger.generate(Xeger.java:80)
    at nl.flotsam.xeger.Xeger.generate(Xeger.java:80)
    at nl.flotsam.xeger.Xeger.generate(Xeger.java:80)
    at nl.flotsam.xeger.Xeger.generate(Xeger.java:80)
    at nl.flotsam.xeger.Xeger.generate(Xeger.java:80)
    at nl.flotsam.xeger.Xeger.generate(Xeger.java:80)
    at nl.flotsam.xeger.Xeger.generate(Xeger.java:80)
    at nl.flotsam.xeger.Xeger.generate(Xeger.java:80)
    at nl.flotsam.xeger.Xeger.generate(Xeger.java:80)
...

Original issue reported on code.google.com by [email protected] on 24 Mar 2015 at 10:50

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

1 participant