DO NOT REPLY [Bug 17707] New: - ArrayIndexOutOfBoundsException in Perl5Matcher.contains

[email protected]
Newsgroups gmane.comp.jakarta.oro.devel
Message-ID <[email protected]>
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17707>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17707

ArrayIndexOutOfBoundsException in Perl5Matcher.contains

           Summary: ArrayIndexOutOfBoundsException in Perl5Matcher.contains
           Product: ORO
           Version: 2.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Main
        AssignedTo: [email protected]
        ReportedBy: [email protected]


the following code causes exception.

import org.apache.oro.text.regex.MatchResult;
import org.apache.oro.text.regex.Pattern;
import org.apache.oro.text.regex.PatternMatcherInput;
import org.apache.oro.text.regex.Perl5Compiler;
import org.apache.oro.text.regex.Perl5Matcher;

public class OroBug
{	
	public static void main(String[] args)
	{
		try
		{
			// string containing (but on exclusivly) an 8bit char
			String src = "n™";
			// expression using ^ and *
			String exp = "[^x]*";
			
			// set up matcher
			Perl5Compiler compiler = new Perl5Compiler();
			Pattern pattern = compiler.compile(exp, Perl5Compiler.CASE_INSENSITIVE_MASK);
			PatternMatcherInput input = new PatternMatcherInput(src);
			Perl5Matcher matcher = new Perl5Matcher();
			
			// throws ArrayIndexOutOfBounds exception
			matcher.contains(input, pattern);
		}
		catch(Throwable e)
		{
			System.out.println(e.getClass().getName() + " : " + e.getMessage());
			e.printStackTrace();
		}
	}
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.