| Log Message: |
I have some quite complicated regular expressions here, that could
generate empty parens. In this special case RE.getParen () from
jakarta-regexp-1.1.jar throws a
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
The exception could be avoided and null returned with something like
this:
RE.java:
public String getParen(int which)
{
int start;
if (which < parenCount && (start = getParenStart(which)) >= 0)
{
return search.substring(start, getParenEnd(which));
}
return null;
}
Or should it throw an exception?
Peter Stieglecker
(Java Newbie)
peter stieglecker pst@ican.at
|