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

URL(URL context, String spec) is giving wrong output when spec is null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.4.0
    • core-libs
    • None
    • x86
    • solaris_8

      URL constructor URL(URL context, String spec) is giving wrong output when spec is "" on solaris 8 with merlin build42.

      How to reproduce the bug:

      Test with the following code on Solaris 8 with Merlin build 42.

      import java.io.*;
      import java.net.*;

      public class TestParseURL {

              public static void main(String[] arg) {

                      try {
                        
                              String urlString = "http://a/b/c/d;p?q";
                              String urlspec = "";

                              System.out.println("url string" + urlString);
                              System.out.println("url spec " + urlspec);

                              URL context = new URL(urlString);

                              System.out.println("context " + context);
                              URL url = new URL(context , urlspec);

                              System.out.println("url string " + url.toString());
                      } catch(Exception exp) {

                              System.out.println(exp.getMessage());
                      }
              }
       
       } // End of class

      Output of the above code for Merlin build 42 :
      url stringhttp://a/b/c/d;p?q
      url spec
      context http://a/b/c/d;p?q
      url string http://a/b/c/d;p


      Output with JDK1.3 :
      url stringhttp://a/b/c/d;p?q
      url spec
      context http://a/b/c/d;p?q
      url string http://a/b/c/d;p?q


      NOTE: When executed with merlin build 42 in the final url '?q' part is missing when spec is "".


            ywangsunw Yingxian Wang (Inactive)
            vakellasunw Venkata Akella (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: