--- 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);
+ }
+ }
+ }
}
/**