Description: Move sharable data out of josm.jar. Author: David Paleino Author: Paul Hartmann Bug-Debian: https://bugs.debian.org/698608 Forwarded: not-needed --- a/src/org/openstreetmap/josm/tools/I18n.java +++ b/src/org/openstreetmap/josm/tools/I18n.java @@ -8,6 +8,7 @@ import java.io.InputStream; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.net.URL; +import java.net.MalformedURLException; import java.nio.charset.StandardCharsets; import java.nio.file.InvalidPathException; import java.text.MessageFormat; @@ -370,7 +371,11 @@ public final class I18n { } private static URL getTranslationFile(String lang) { - return I18n.class.getResource(CORE_TRANS_DIRECTORY + lang.replace('@', '-') + ".lang"); + try { + return new URL("file:///usr/share/josm/data/"+lang.replace('@', '-')+".lang"); + } catch (MalformedURLException ex) { + return null; + } } /** --- a/src/org/openstreetmap/josm/io/CachedFile.java +++ b/src/org/openstreetmap/josm/io/CachedFile.java @@ -227,8 +227,14 @@ public class CachedFile implements Close File file = getFile(); if (file == null) { if (name != null && name.startsWith("resource://")) { - return Optional.ofNullable(ResourceProvider.getResourceAsStream(name.substring("resource:/".length()))) - .orElseThrow(() -> new IOException(tr("Failed to open input stream for resource ''{0}''", name))); + String resourceName = name.substring("resource:/".length()); + File fileRes = new File("/usr/share/josm/" + resourceName); + if (fileRes.exists()) { + file = fileRes; + } else { + return Optional.ofNullable(ResourceProvider.getResourceAsStream(name.substring("resource:/".length()))) + .orElseThrow(() -> new IOException(tr("Failed to open input stream for resource ''{0}''", name))); + } } else { throw new IOException("No file found for: "+name); }