This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: fix buglet in java.net.URI (PR libgcj/21606)
- 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: 16 May 2005 14:24:28 -0600
- Subject: Patch: fix buglet in java.net.URI (PR libgcj/21606)
- Reply-to: tromey at redhat dot com
I'm checking this in on the trunk, the 4.0 branch, and Classpath.
This fixes libgcj PR 21606. The bug is that lower-case letters in a
"%xx"-style quote are not handled properly by URI.
The bug report came with a test case, which I checked in to Mauve.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
PR libgcj/21606:
* java/net/URI.java (unquote): Handle lower-case letters as well.
Index: java/net/URI.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/URI.java,v
retrieving revision 1.10
diff -u -r1.10 URI.java
--- java/net/URI.java 20 Apr 2005 09:36:06 -0000 1.10
+++ java/net/URI.java 16 May 2005 20:20:16 -0000
@@ -313,9 +313,8 @@
{
if (i + 2 >= str.length())
throw new URISyntaxException(str, "Invalid quoted character");
- String hex = "0123456789ABCDEF";
- int hi = hex.indexOf(str.charAt(++i));
- int lo = hex.indexOf(str.charAt(++i));
+ int hi = Character.digit(str.charAt(++i), 16);
+ int lo = Character.digit(str.charAt(++i), 16);
if (lo < 0 || hi < 0)
throw new URISyntaxException(str, "Invalid quoted character");
buf[pos++] = (byte) (hi * 16 + lo);