This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: URI fixlet
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Cc: classpath-patches at gnu dot org
- Date: 08 Feb 2005 19:52:08 -0700
- Subject: Patch: FYI: URI fixlet
- Reply-to: tromey at redhat dot com
I'm checking this in to libgcj and classpath.
This fixes a bug in URI. The user and port parts of the authority
are optional. I think this used to "work" but a recent bug fix to
regex broke it.
I've checked in a test case to Mauve. We don't pass all the URI tests
(and I'm not sure if we ever did), but with this we do a little
better. As was pointed out recently, our URI implementation needs a
lot of love.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* java/net/URI.java (AUTHORITY_REGEXP): Handle case where user
name or port is missing.
(AUTHORITY_USERINFO_GROUP, AUTHORITY_HOST_GROUP,
AUTHORITY_PORT_GROUP): Updated.
Index: java/net/URI.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URI.java,v
retrieving revision 1.8
diff -u -r1.8 URI.java
--- java/net/URI.java 15 Jan 2005 22:27:02 -0000 1.8
+++ java/net/URI.java 9 Feb 2005 02:47:28 -0000
@@ -65,7 +65,7 @@
"^(([^:/?#]+):)?((//([^/?#]*))?([^?#]*)(\\?([^#]*))?)?(#(.*))?";
private static final String AUTHORITY_REGEXP =
- "^(([^?#]*)@([^?#]*):([^?#]*))?";
+ "^((([^?#]*)@)?([^?#:]*)(:([^?#]*)))?";
/**
* Valid characters (taken from rfc2396)
@@ -115,9 +115,9 @@
*/
private static final int FRAGMENT_GROUP = 10;
- private static final int AUTHORITY_USERINFO_GROUP = 2;
- private static final int AUTHORITY_HOST_GROUP = 3;
- private static final int AUTHORITY_PORT_GROUP = 4;
+ private static final int AUTHORITY_USERINFO_GROUP = 3;
+ private static final int AUTHORITY_HOST_GROUP = 4;
+ private static final int AUTHORITY_PORT_GROUP = 6;
private transient String scheme;
private transient String rawSchemeSpecificPart;