Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4402326

URLDecoder fails with certain input

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.4.0
    • core-libs
    • None
    • beta
    • sparc
    • solaris_8
    • Verified

      URLDecoder fails with certain input with merlin build 46 on Solaris. Its throwing java.lang.IllegalArgumentException with certain input. Same test passed with jdk1.3.

      How to reproduce the problem:

      1. Take the following code.

      public class EncodeDecode {

              public static void main(String[] args) {

              String str = "aslf alsf alsdjf";
       
              if(args.length > 0)
                      str=args[0];
          
       
              String encStr = URLEncoder.encode(str);
              System.out.println("Encode string " + encStr);

              String decStr = URLDecoder.decode(encStr);
              System.out.println("Decoded String " + decStr);


              }

      }


      2. Execute as shown below.

      java EncodeDecode 'asdf @$'
      or
      java EncodeDecode fdadf@$

      On execution as shown above output will be like this:

      % java EncodeDecode fds@$
      Encode string fds%40%24
      Exception in thread "main" java.lang.IllegalArgumentException: URLDecoder: Incomplete trailing escape (%) pattern
              at java.net.URLDecoder.decode(URLDecoder.java:150)
              at java.net.URLDecoder.decode(URLDecoder.java:72)
              at EncodeDecode.main(EncodeDecode.java:21)


      Other Information:

      1. Its passed with jdk1.3 on solaris 8.

            michaelm Michael McMahon
            vakellasunw Venkata Akella (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: