T
Tim Slattery
I'm getting an "IndexOutOfBoundsException" from the regex processor
when I call String.replaceAll.
Here's the call:
String result = upload.replaceAll("\\{FileName\\}", fileName);
"upload" is a string that contains at least one occurrence of
"{FileName}", which is to be replaced by the actual filename passed
into this method. Unfortunately, I don't know what the filename was
when the exception occurred. The stacktrace looks like this:
java.lang.IndexOutOfBoundsException: No group 5
at java.util.regex.Matcher.group(Matcher.java:470)
at java.util.regex.Matcher.appendReplacement(Matcher.java:737)
at java.util.regex.Matcher.replaceAll(Matcher.java:813)
at java.lang.String.replaceAll(String.java:2189)
at (the line shown above)
I'm aware that replaceAll uses the regexp mechanism for matching
strings. But I can't imagine what could cause this exception. Does
anybody have a clue?
when I call String.replaceAll.
Here's the call:
String result = upload.replaceAll("\\{FileName\\}", fileName);
"upload" is a string that contains at least one occurrence of
"{FileName}", which is to be replaced by the actual filename passed
into this method. Unfortunately, I don't know what the filename was
when the exception occurred. The stacktrace looks like this:
java.lang.IndexOutOfBoundsException: No group 5
at java.util.regex.Matcher.group(Matcher.java:470)
at java.util.regex.Matcher.appendReplacement(Matcher.java:737)
at java.util.regex.Matcher.replaceAll(Matcher.java:813)
at java.lang.String.replaceAll(String.java:2189)
at (the line shown above)
I'm aware that replaceAll uses the regexp mechanism for matching
strings. But I can't imagine what could cause this exception. Does
anybody have a clue?