# HG changeset patch # User Jiri Vanek # Date 1545128138 -3600 # Node ID dfc800562a29ddfac9b16f3352738bcceb1f1faa # Parent fd84d9b293df9a2c8fcda4a936b15de517ffb438 Fixed PR3637 - making cache work with jdk9+ #runtime jar url anchor * netx/net/sourceforge/jnlp/runtime/CachedJarFileCallback.java: (retrieve) if jar is not found in cache, ale url without anchor is attempted * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: usinf localFile.toURI().toURL() instead of direct localFile.toURL() diff -r fd84d9b293df -r dfc800562a29 ChangeLog --- a/ChangeLog Fri Nov 23 15:33:04 2018 +0100 +++ b/ChangeLog Tue Dec 18 11:15:38 2018 +0100 @@ -1,3 +1,10 @@ +2018-11-27 Jiri Vanek + Lars Herschke + + Fixed PR3637 - making cache work with jdk9+ #runtime jar url anchor + * netx/net/sourceforge/jnlp/runtime/CachedJarFileCallback.java: (retrieve) if jar is not found in cache, ale url without anchor is attempted + * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: usinf localFile.toURI().toURL() instead of direct localFile.toURL() + 2018-11-23 Lars Herschke Jiri Vanek diff -r fd84d9b293df -r dfc800562a29 netx/net/sourceforge/jnlp/runtime/CachedJarFileCallback.java --- a/netx/net/sourceforge/jnlp/runtime/CachedJarFileCallback.java Fri Nov 23 15:33:04 2018 +0100 +++ b/netx/net/sourceforge/jnlp/runtime/CachedJarFileCallback.java Tue Dec 18 11:15:38 2018 +0100 @@ -86,6 +86,12 @@ @Override public java.util.jar.JarFile retrieve(URL url) throws IOException { URL localUrl = mapping.get(url); + if (localUrl == null) { + if (url.getRef() != null) { + url = new URL(url.toString().substring(0, url.toString().lastIndexOf(url.getRef()) - 1)); + localUrl = mapping.get(url); + } + } if (localUrl == null) { /* diff -r fd84d9b293df -r dfc800562a29 netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java --- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Fri Nov 23 15:33:04 2018 +0100 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Tue Dec 18 11:15:38 2018 +0100 @@ -1401,7 +1401,7 @@ // there is currently no mechanism to cache files per // instance.. so only index cached files if (localFile != null) { - CachedJarFileCallback.getInstance().addMapping(jar.getLocation(), localFile.toURL()); + CachedJarFileCallback.getInstance().addMapping(jar.getLocation(), localFile.toURI().toURL()); try (JarFile jarFile = new JarFile(localFile.getAbsolutePath())) { Manifest mf = jarFile.getManifest();