src/java.base/share/classes/java/net/URL.java
changeset 58631 36c5e85b8597
parent 58242 94bb65cb37d3
child 58679 9c3209ff7550
--- a/src/java.base/share/classes/java/net/URL.java	Fri Jun 21 10:51:10 2019 +0100
+++ b/src/java.base/share/classes/java/net/URL.java	Tue Jun 25 00:07:47 2019 +0100
@@ -484,6 +484,16 @@
                 throw new MalformedURLException(s);
             }
         }
+        if ("jar".equalsIgnoreCase(protocol)) {
+            if (handler instanceof sun.net.www.protocol.jar.Handler) {
+                // URL.openConnection() would throw a confusing exception
+                // so generate a better exception here instead.
+                String s = ((sun.net.www.protocol.jar.Handler) handler).checkNestedProtocol(file);
+                if (s != null) {
+                    throw new MalformedURLException(s);
+                }
+            }
+        }
     }
 
     /**