when the limits of the pattern in the program bellow are {4, 15} - everything is ok and works. but when the right boundary is > 15, and the string, passed to match is shorter than 16 chars, a java.lang.ArrayIndexOutOfBoundsException is being thrown. stacktrace: at org.apache.regexp.RE.getParenEnd(RE.java:719) at org.apache.regexp.RE.matchNodes(RE.java:937) at org.apache.regexp.RE.matchNodes(RE.java:905) at org.apache.regexp.RE.matchNodes(RE.java:928) at org.apache.regexp.RE.matchNodes(RE.java:905) ... continues. I use win2k service pack 2, build 5.00.2195, JDK 1.3.1 : java version "1.3.1" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24) Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode) import org.apache.regexp.*; public class RegExpTest { public static void main(String[] args) { try { RE re = new RE("^(\\w){4,16}$"); System.out.println("mathes: " + re.match(args[0])); }catch (RESyntaxException re) { re.printStackTrace(); } } }
actually this exception occurs only when RE.match should return true - e.g. when the chars in the word are between 4, 16. if the right limit is <= 15, everything is ok - it returns true || false. but when it is bigger than 15, it returns false as expected, but when the string matches the regexpression, and we expect true, this exception is being thrown
Tried with 1.3-dev with following in RETest.txt: #1 ^(\w){4,16}$ abcdefghijklmnop YES abcdefghijklmnop a b c d e f g h i j k l m n o p No exception were thrown. Please try and if you can able to reproduce exception, reopen the bug, and specify exact arguments reproducing it.
closed