classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Patch: fix buglet in java.net.URI (PR libgcj/21606)


From: Tom Tromey
Subject: [cp-patches] Patch: fix buglet in java.net.URI (PR libgcj/21606)
Date: 16 May 2005 14:24:28 -0600
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

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  <address@hidden>

        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);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]