Summary: | java.util.regex.Matcher.group(int) differs from Sun's API | ||
---|---|---|---|
Product: | classpath | Reporter: | from-classpath |
Component: | classpath | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bug-classpath |
Priority: | P3 | ||
Version: | unspecified | ||
Target Milestone: | 0.90 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: |
Description
from-classpath
2005-02-13 14:40:02 UTC
java.util.regex.Matcher returns IllegalStateException for itself, see assertMatchOp at the end of Matcher.java; so gnu.regexp.REMatch doesn't have to throw it. /gnu/regexp/REMatch.java, however, does incorrectly return empty strings instead of null values for groups that are outside the range of the regex's result. Attached is a simple patch that corrects the issue in REMatch.java. My patch was not done with following the patch-from-project-root-directory convention, I have attached a corrected patch. I have also renamed it. The proposed patch seems to have been lost when this bug was carried over from the old bug tracking system. Does anyone have the proposed patch? Subject: Re: java.util.regex.Matcher.group(int) differs from Sun's API On Tue, 2006-01-17 at 22:24 +0000, kaz at maczuka dot gcd dot org wrote: > ------- Comment #3 from kaz at maczuka dot gcd dot org 2006-01-17 22:24 ------- > The proposed patch seems to have been lost when this bug was carried > over from the old bug tracking system. > > Does anyone have the proposed patch? Unfortunately it seems to have been lost. It was submitted by the savannah user Joe Gallo <tellerpenn>: http://savannah.gnu.org/users/tellerpenn Subject: Bug 22873 CVSROOT: /cvsroot/classpath Module name: classpath Branch: Changes by: Ito Kazumitsu <itokaz@savannah.gnu.org> 06/01/31 14:57:43 Modified files: . : ChangeLog gnu/regexp : REMatch.java Log message: 2006-01-31 Ito Kazumitsu <kaz@maczuka.gcd.org> Fixes bug #22873 * gnu/regexp/REMatch(toString(int)): Throw IndexOutOfBoundsException for an invalid index and return null for a skipped group. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6231&tr2=1.6232&r1=text&r2=text http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/regexp/REMatch.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text Fixed. |