src/java.base/share/classes/java/net/URLStreamHandler.java
changeset 55126 d2bc284803bc
parent 53018 8bf9268df0e2
child 55500 80abfee2afaf
--- a/src/java.base/share/classes/java/net/URLStreamHandler.java	Thu May 16 17:09:11 2019 +0200
+++ b/src/java.base/share/classes/java/net/URLStreamHandler.java	Fri May 31 15:02:45 2019 +0100
@@ -76,9 +76,15 @@
      * support proxying will ignore the proxy parameter and make a
      * normal connection.
      *
-     * Calling this method preempts the system's default
+     * <p> Calling this method preempts the system's default
      * {@link java.net.ProxySelector ProxySelector} settings.
      *
+     * @implSpec
+     * The default implementation of this method first checks that the given
+     * {code URL} and {code Proxy} are not null, then throws {@code
+     * UnsupportedOperationException}. Subclasses should override this method
+     * with an appropriate implementation.
+     *
      * @param      u   the URL that this connects to.
      * @param      p   the proxy through which the connection will be made.
      *                 If direct connection is desired, Proxy.NO_PROXY
@@ -93,6 +99,8 @@
      * @since      1.5
      */
     protected URLConnection openConnection(URL u, Proxy p) throws IOException {
+        if (u == null || p == null)
+            throw new IllegalArgumentException("null " + (u == null ? "url" : "proxy"));
         throw new UnsupportedOperationException("Method not implemented.");
     }