On Tue, 2006-01-31 at 23:59 +0900, Ito Kazumitsu wrote: > 2006-01-31 Ito Kazumitsu <[EMAIL PROTECTED]> > > Fixes bug #22873 > * gnu/regexp/REMatch(toString(int)): Throw IndexOutOfBoundsException > for an invalid index and return null for a skipped group.
It seems we are abusing the Matcher in our URI implementation. And this
patch broke that. Here is an update to URI to make a couple of Mauve
tests work again:
2006-01-31 Mark Wielaard <[EMAIL PROTECTED]>
* java/net/URI.java (getURIGroup): Check for null to see
whether group actually exists.
Committed,
Mark
Index: java/net/URI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/URI.java,v
retrieving revision 1.16
diff -u -r1.16 URI.java
--- java/net/URI.java 2 Jul 2005 20:32:39 -0000 1.16
+++ java/net/URI.java 31 Jan 2006 21:57:55 -0000
@@ -1,5 +1,5 @@
/* URI.java -- An URI class
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -346,8 +346,15 @@
private static String getURIGroup(Matcher match, int group)
{
String matched = match.group(group);
- return matched.length() == 0
- ? ((match.group(group - 1).length() == 0) ? null : "") : matched;
+ if (matched == null || matched.length() == 0)
+ {
+ String prevMatched = match.group(group -1);
+ if (prevMatched == null || prevMatched.length() == 0)
+ return null;
+ else
+ return "";
+ }
+ return matched;
}
/**
signature.asc
Description: This is a digitally signed message part
