RE: java.lang.ArrayIndexOutOfBoundsException evaluating regexp

"Sanno Point - R.Caprio" <[email protected]> Wed, 9 Mar 2005 11:42:02 -0500
Newsgroups gmane.comp.jakarta.regexp.user
Message-ID <[email protected]>
Max length 4096 starting at 0, gives a maximum index of 4095

rc

IMPORTANT: E-mails from this company normally contain confidential =
material for the sole use of the intended recipient. The use, =
distribution, transmittal or re-transmittal by an unintended recipient =
of any communication is prohibited without our express approval in =
writing or by e-mail. Any use, distribution, transmittal or =
re-transmittal by persons who are not intended recipients of this e-mail =
may be a violation of law and is strictly prohibited. If you are not the =
intended recipient please contact the sender and delete all copies. =
E-mail transmission cannot be guaranteed to be secure or error-free. The =
sender therefore does not accept liability for any errors or omissions =
in the contents of this transmission. This message is provided for =
informational purposes only and should not be construed as an offer to =
sell or the solicitation of an offer to buy any securities or related =
financial instruments.  All e-mails sent to or from Sanno Point Capital =
Management L.L.C. and its affiliates are to be used for our business =
purposes only. E-mails sent from or to the company are subject to review =
by the company.

-----Original Message-----
From: B=F6hringer Jochen [mailto:[email protected]]=20
Sent: Friday, February 25, 2005 5:31 AM
To: [email protected]
Subject: java.lang.ArrayIndexOutOfBoundsException evaluating regexp

Hi,

we use the regexp package version 1.3 in our webapplication to validate =
user inputs. One user input field has a max length of 4096 characters.
So the following regexp is used: .{0,4096}
and leads to this exception:=20

java.lang.ArrayIndexOutOfBoundsException: -16381
	at org.apache.regexp.RE.matchNodes(Unknown Source)
	at org.apache.regexp.RE.matchAt(Unknown Source)
	at org.apache.regexp.RE.match(Unknown Source)
	at org.apache.regexp.RE.match(Unknown Source)
	at org.apache.regexp.RE.match(Unknown Source)
	at de.tcc_products.test.RegExpTester.main(RegExpTester.java:10)

If I split up the regexp in a semantically similar regexp: =
(.{0,128}){0,32}

everything works fine.

Is this a bug or is something wrong with the regexp?

This code snippet can be used to reproduce the error:

package de.tcc_products.test;

import org.apache.regexp.RE;

public class RegExpTester
{
	public static void main(String[] args)
	{
        RE regExp =3D new RE(".{0,4096}");
        System.out.println("Matches: " + regExp.match("ABC"));
	}
}



Thx
Jochen

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]