You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-user@jakarta.apache.org by "Sureka, Sushil" <Su...@tgslc.org> on 2002/11/13 22:38:52 UTC

java.lang.StringIndexOutOfBoundsException Exception

Hello All,

 

I wasn't sure if it is suitable for dev or user so I am sending it to both
the groups.

 

I have run into an issue and it seems like it can be a issue in regexp
package. Here is the exception stack trace

 

ava.lang.StringIndexOutOfBoundsException: String index out of range: 7

            at java.lang.String.charAt(String.java:511)

            at
org.apache.regexp.StringCharacterIterator.charAt(StringCharacterIterator.jav
a:90)

            at org.apache.regexp.RE.matchNodes(RE.java:1320)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchNodes(RE.java:910)

            at org.apache.regexp.RE.matchNodes(RE.java:1376)

            at org.apache.regexp.RE.matchAt(RE.java:1448)

            at org.apache.regexp.RE.match(RE.java:1498)

            at org.apache.regexp.RE.match(RE.java:1468)

            at org.apache.regexp.RE.match(RE.java:1561)

            at
org.tgslc.service.validation.rule.RegExpRule.violatesCondition(RegExpRule.ja
va:147)

 

All I am doing at RegExpRule.violatesCondition is calling
re.match(SOME_STRING).

 

The regular expression it is trying to match against is (^[A-Za-z0-9\-/
]*$)|(^[Nn]/[Aa]$)

 

The string is getting read from the file and it is getting matched against
this expression. The thing is if we have multiple files running we have run
into this issue off and on, but the same file (which fails when we are
running multiple files simultaneously)  processes ok if we are running by
itself.

 

This points me to some synchronization problem but then we don't store the
Re class as static variable. Any idea what might be going wrong here??

 

Sushil