Sushil --

I have received a number of exceptions from regexp.  I don't recall this particular 
one, but I have seen several other index out of bounds exceptions.  

Here are some notes I made a while back.  Perhaps they will be of use.
The behavior of RE on character classes, [...], does not meet the normal rules for 
regular expressions. 
 -- To include '-', use [...\-].
    '\-' must be the last item within the brackets; otherwise it is ignored.
    [-...] matches characters that are not in the character class.
    --- gives an exception.
 -- The behavior of '.', '+', '/', and '_' together within [] is bizarre and defies 
description.
    Sometimes one of them must be doubled to be matched.

-- Rich Mallory


-----Original Message-----
From: Sureka, Sushil [mailto:Sushil.Sureka@;tgslc.org]
Sent: Wednesday, November 13, 2002 3:39 PM
To: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]'
Subject: 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

java.lang.StringIndexOutOfBoundsException: String index out of range: 7
            at java.lang.String.charAt(String.java:511)
            at 
org.apache.regexp.StringCharacterIterator.charAt(StringCharacterIterator.java: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.java: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

--
To unsubscribe, e-mail:   <mailto:regexp-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:regexp-dev-help@;jakarta.apache.org>

Reply via email to