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

URL constructor throws MalformedURLException with upper case letters

XMLWordPrintable

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

      URL constructor URL(String protocol, String host, int port, String file) throws MalformedURLException when its called with uppercase protocol names like 'HTTP' and 'FTP'. But if we specify uppercase in URL(String spec) then it doesnt throw any exception. It accepts properly. Its coming in merlin build 59.

      Example:
      URL u3 = new URL("HTTP://www.javasoft.eng:80/path1/path2");

      Its not throwing exception.


      URL u4 = new URL("HTTP", "10:100::1234", 9999, "/index.html");

      Its throwing the following exception
      java.net.MalformedURLException: unknown protocol: HTTP
              at java.net.URL.<init>(URL.java:313)
              at java.net.URL.<init>(URL.java:226)
              at TestURL1.main(TestURL1.java:71)

            alanb Alan Bateman
            vakellasunw Venkata Akella (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: