Stack Overflow Problem

"Martin Thomas" <[email protected]> Mon, 10 Feb 2003 15:05:08 -0000
Newsgroups gmane.comp.jakarta.oro.user
Organization Scarce Skills Limited
Message-ID <3E47BFA4.16787.F0DE1CF@localhost>
Hello,

I'm using ORO 2.0.7 and I get a stack overflow exception with the following:

import org.apache.oro.text.regex.*;

public final class testcase {
public static final void main(String args[])
{
    String expression = "(\\(|\\)|^| |,|\\.|;)Baseline(.)*(\\(|\\)| |,|\\.|;|$)";
    String matchString = "this is a very large string " +
							"..." +
							"that has been cut-out for email purposes";
	Pattern pattern   = null;
    PatternMatcherInput input;
    PatternCompiler compiler;
    PatternMatcher matcher;
    MatchResult result;

    // Create Perl5Compiler and Perl5Matcher instances.
    compiler = new Perl5Compiler();
    matcher  = new Perl5Matcher();

    try {
      pattern = compiler.compile(expression, Perl5Compiler.CASE_INSENSITIVE_MASK);
    } catch(MalformedPatternException e)
    {
      System.err.println("Bad pattern.");
      System.err.println(e.getMessage());
      System.exit(1);
    }
    System.out.println(matcher.contains(matchString, pattern));
	}
}

When I run this, I get the following error message (JDK 1.3):

Exception in thread "main" java.lang.StackOverflowError
        at java.util.Stack.push(Stack.java:47)
        at org.apache.oro.text.regex.Perl5Matcher.__pushState(Unknown Source)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Unknown Source)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Unknown Source)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Unknown Source)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Unknown Source)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Unknown Source)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Unknown Source)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Unknown Source)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Unknown Source)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Unknown Source)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Unknown Source)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Unknown Source)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Unknown Source)
... (repeated lot's of times)
        at org.apache.oro.text.regex.Perl5Matcher.__match(Unknown Source)


Any help / advice would be appreciated.

Thanks

Martin.