ArrayIndexOutOfBoundsException

"Adam Jack" <[email protected]> Thu, 17 Apr 2003 12:39:06 -0600
Newsgroups gmane.comp.jakarta.regexp.user
Message-ID <00b601c30510$a0f03be0$fab5ea43@wdn086>
Hello,

I am using Jakarta RegExp 1.2.

I have a regular expression that compiles, yet crashes on me with certain
content (and not with other).

I can cause the behaviour or not (but not get what I need) by removing the
( and ) around the [a-z] in here:

Crashes:

     	  // .MAJOR, .MINOR, .POINT,
        // -RELEASE_LEVEL w/ QUALIFIER,
        // -BUILD_NUMBER,
        // -VARIANT, TYPE

    +
"(-(\\d+)(\\.(\\d+))?(\\.(\\d+))?(-([a-z])+(\\d*))?(-(\\d*))?)?(-([^\\.]*))?
(\\..*)?"

Does not crash:

    +
"(-(\\d+)(\\.(\\d+))?(\\.(\\d+))?(-[a-z]+(\\d*))?(-(\\d*))?)?(-([^\\.]*))?(\
\..*)?"

Basically I am trying to match something like
foo-1.2.3-dev1-20032102-src.jar w/ lots of optional parts.

Maybe there is too much similarity within the -dev1 and -src parts, or maybe
it is nothing to do with that.

Below is the stack trace.

Any insights/help would be greatly appreciated.

Thanks in advance

regards

Adam


MetaInfo : Name:toto,Version: (toto|[major,minor,releaseLevel] (0,1)),
Varient:null, Type:null
Version  : toto|[major,minor,releaseLevel] (0,1)
java.lang.ArrayIndexOutOfBoundsException: 16
	at org.apache.regexp.RE.getParenEnd(RE.java:724)
	at org.apache.regexp.RE.matchNodes(RE.java:942)
	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.matchNodes(RE.java:1376)
	at org.apache.regexp.RE.matchNodes(RE.java:1376)
	at org.apache.regexp.RE.matchNodes(RE.java:933)
	at org.apache.regexp.RE.matchNodes(RE.java:1376)
	at org.apache.regexp.RE.matchNodes(RE.java:933)
	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.matchNodes(RE.java:933)
	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.matchNodes(RE.java:933)
	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.matchNodes(RE.java:910)
	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.krysalis.ruper.model.impl.FilenameInfoExtractor.parseStandardFormat(File
nameInfoExtractor.java:252)
	at
org.krysalis.ruper.model.impl.FilenameInfoExtractor.parse(FilenameInfoExtrac
tor.java:177)
	at
org.krysalis.ruper.model.impl.FilenameInfoExtractor.main(FilenameInfoExtract
or.java:394)
Exception in thread "main"
--
<http://www.try.sybase.com>
Experience Sybase Technology ...