Index: trunk/src/org/openstreetmap/josm/io/CachedFile.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/CachedFile.java	(revision 14403)
+++ trunk/src/org/openstreetmap/josm/io/CachedFile.java	(revision 14404)
@@ -226,8 +226,16 @@
         if (file == null) {
             if (name != null && name.startsWith("resource://")) {
-                InputStream is = getClass().getResourceAsStream(
-                        name.substring("resource:/".length()));
-                if (is == null)
-                    throw new IOException(tr("Failed to open input stream for resource ''{0}''", name));
+                String resourceName = name.substring("resource:/".length());
+                InputStream is = getClass().getResourceAsStream(resourceName);
+                if (is == null) {
+                    URL resource = getClass().getResource(resourceName);
+                    if (resource != null) {
+                        // More robust way to open stream
+                        is = Utils.openStream(resource);
+                    }
+                    if (is == null) {
+                        throw new IOException(tr("Failed to open input stream for resource ''{0}''", name));
+                    }
+                }
                 return is;
             } else {
Index: trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 14403)
+++ trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 14404)
@@ -1166,6 +1166,12 @@
                 try {
                     URI uri = getSvgUniverse().loadSVG(path);
+                    if (uri == null && "jar".equals(path.getProtocol())) {
+                        URL betterPath = Utils.betterJarUrl(path);
+                        if (betterPath != null) {
+                            uri = getSvgUniverse().loadSVG(betterPath);
+                        }
+                    }
                     svg = getSvgUniverse().getDiagram(uri);
-                } catch (SecurityException e) {
+                } catch (SecurityException | IOException e) {
                     Logging.log(Logging.LEVEL_WARN, "Unable to read SVG", e);
                 }
Index: trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 14403)
+++ trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 14404)
@@ -1846,23 +1846,9 @@
                 try {
                     return url.openStream();
-                } catch (FileNotFoundException e) {
-                    // Workaround to https://bugs.openjdk.java.net/browse/JDK-4523159
-                    String urlPath = url.getPath();
-                    if (urlPath.startsWith("file:/") && urlPath.split("!").length > 2) {
+                } catch (FileNotFoundException | InvalidPathException e) {
+                    URL betterUrl = betterJarUrl(url);
+                    if (betterUrl != null) {
                         try {
-                            // Locate jar file
-                            int index = urlPath.lastIndexOf("!/");
-                            Path jarFile = Paths.get(urlPath.substring("file:/".length(), index));
-                            Path filename = jarFile.getFileName();
-                            FileTime jarTime = Files.readAttributes(jarFile, BasicFileAttributes.class).lastModifiedTime();
-                            // Copy it to temp directory (hopefully free of exclamation mark) if needed (missing or older jar)
-                            Path jarCopy = Paths.get(getSystemProperty("java.io.tmpdir")).resolve(filename);
-                            if (!jarCopy.toFile().exists() ||
-                                    Files.readAttributes(jarCopy, BasicFileAttributes.class).lastModifiedTime().compareTo(jarTime) < 0) {
-                                Files.copy(jarFile, jarCopy, StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES);
-                            }
-                            // Open the stream using the copy
-                            return new URL(url.getProtocol() + ':' + jarCopy.toUri().toURL().toExternalForm() + urlPath.substring(index))
-                                    .openStream();
+                            return betterUrl.openStream();
                         } catch (RuntimeException | IOException ex) {
                             Logging.warn(ex);
@@ -1876,3 +1862,31 @@
         }
     }
+
+    /**
+     * Tries to build a better JAR URL if we find it concerned by a JDK bug.
+     * @param jarUrl jar URL to test
+     * @return potentially a better URL that won't provoke a JDK bug, or null
+     * @throws IOException if an I/O error occurs
+     * @since 14404
+     */
+    public static URL betterJarUrl(URL jarUrl) throws IOException {
+        // Workaround to https://bugs.openjdk.java.net/browse/JDK-4523159
+        String urlPath = jarUrl.getPath().replace("%20", " ");
+        if (urlPath.startsWith("file:/") && urlPath.split("!").length > 2) {
+            // Locate jar file
+            int index = urlPath.lastIndexOf("!/");
+            Path jarFile = Paths.get(urlPath.substring("file:/".length(), index));
+            Path filename = jarFile.getFileName();
+            FileTime jarTime = Files.readAttributes(jarFile, BasicFileAttributes.class).lastModifiedTime();
+            // Copy it to temp directory (hopefully free of exclamation mark) if needed (missing or older jar)
+            Path jarCopy = Paths.get(getSystemProperty("java.io.tmpdir")).resolve(filename);
+            if (!jarCopy.toFile().exists() ||
+                    Files.readAttributes(jarCopy, BasicFileAttributes.class).lastModifiedTime().compareTo(jarTime) < 0) {
+                Files.copy(jarFile, jarCopy, StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES);
+            }
+            // Return URL using the copy
+            return new URL(jarUrl.getProtocol() + ':' + jarCopy.toUri().toURL().toExternalForm() + urlPath.substring(index));
+        }
+        return null;
+    }
 }
