Fix handling of jar files with + chars in their path

Closes gh-17208
This commit is contained in:
Andy Wilkinson
2019-06-17 10:31:51 +01:00
parent 4894affbb6
commit 7d59b78829
2 changed files with 30 additions and 3 deletions

View File

@@ -20,9 +20,9 @@ import java.io.File;
import java.io.IOException;
import java.lang.ref.SoftReference;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLDecoder;
import java.net.URLStreamHandler;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -302,8 +302,7 @@ public class Handler extends URLStreamHandler {
if (!name.startsWith(FILE_PROTOCOL)) {
throw new IllegalStateException("Not a file URL");
}
String path = name.substring(FILE_PROTOCOL.length());
File file = new File(URLDecoder.decode(path, "UTF-8"));
File file = new File(URI.create(name));
Map<File, JarFile> cache = rootFileCache.get();
JarFile result = (cache != null) ? cache.get(file) : null;
if (result == null) {