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)
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)
- relates to
-
JDK-4520960 Compatibility issue with URL.getProtocol()
-
- Closed
-