diff -r 4ddbc841ced3 -r 9229b3f76c40 jdk/src/java.base/share/classes/java/net/URL.java --- a/jdk/src/java.base/share/classes/java/net/URL.java Mon Dec 21 09:05:25 2015 -0800 +++ b/jdk/src/java.base/share/classes/java/net/URL.java Tue Dec 15 17:35:27 2015 +0100 @@ -310,7 +310,8 @@ * @param host the name of the host. * @param port the port number on the host. * @param file the file on the host - * @exception MalformedURLException if an unknown protocol is specified. + * @exception MalformedURLException if an unknown protocol or the port + * is a negative number other than -1 * @see java.lang.System#getProperty(java.lang.String) * @see java.net.URL#setURLStreamHandlerFactory( * java.net.URLStreamHandlerFactory) @@ -329,9 +330,9 @@ * name, {@code host} name, and {@code file} name. The * default port for the specified protocol is used. *

- * This method is equivalent to calling the four-argument - * constructor with the arguments being {@code protocol}, - * {@code host}, {@code -1}, and {@code file}. + * This constructor is equivalent to the four-argument + * constructor with the only difference of using the + * default port for the specified protocol. * * No validation of the inputs is performed by this constructor. * @@ -372,7 +373,8 @@ * @param port the port number on the host. * @param file the file on the host * @param handler the stream handler for the URL. - * @exception MalformedURLException if an unknown protocol is specified. + * @exception MalformedURLException if an unknown protocol or the port + is a negative number other than -1 * @exception SecurityException * if a security manager exists and its * {@code checkPermission} method doesn't allow @@ -446,7 +448,9 @@ * * @param spec the {@code String} to parse as a URL. * @exception MalformedURLException if no protocol is specified, or an - * unknown protocol is found, or {@code spec} is {@code null}. + * unknown protocol is found, or {@code spec} is {@code null}, + * or the parsed URL fails to comply with the specific syntax + * of the associated protocol. * @see java.net.URL#URL(java.net.URL, java.lang.String) */ public URL(String spec) throws MalformedURLException { @@ -493,7 +497,9 @@ * @param context the context in which to parse the specification. * @param spec the {@code String} to parse as a URL. * @exception MalformedURLException if no protocol is specified, or an - * unknown protocol is found, or {@code spec} is {@code null}. + * unknown protocol is found, or {@code spec} is {@code null}, + * or the parsed URL fails to comply with the specific syntax + * of the associated protocol. * @see java.net.URL#URL(java.lang.String, java.lang.String, * int, java.lang.String) * @see java.net.URLStreamHandler @@ -513,7 +519,9 @@ * @param spec the {@code String} to parse as a URL. * @param handler the stream handler for the URL. * @exception MalformedURLException if no protocol is specified, or an - * unknown protocol is found, or {@code spec} is {@code null}. + * unknown protocol is found, or {@code spec} is {@code null}, + * or the parsed URL fails to comply with the specific syntax + * of the associated protocol. * @exception SecurityException * if a security manager exists and its * {@code checkPermission} method doesn't allow