Description: Move sharable data out of josm.jar.
Author: David Paleino <dapal@debian.org>
Author: Paul Hartmann <phaaurlt@googlemail.com>
Bug-Debian: https://bugs.debian.org/698608
Forwarded: not-needed

--- a/build.xml
+++ b/build.xml
@@ -209,9 +209,6 @@ Debian-Release: ${debian.version}
                 <attribute name="Add-Opens" value="java.base/java.lang java.base/java.nio java.base/jdk.internal.loader java.base/jdk.internal.ref java.desktop/javax.imageio.spi java.desktop/javax.swing.text.html java.prefs/java.util.prefs" />
             </manifest>
             <service type="java.text.spi.DecimalFormatSymbolsProvider" provider="org.openstreetmap.josm.tools.JosmDecimalFormatSymbolsProvider" />
-            <zipfileset dir="images" prefix="images"/>
-            <zipfileset dir="data" prefix="data"/>
-            <zipfileset dir="styles" prefix="styles"/>
         </jar>
     </target>
     <!-- Mac OS X target -->
--- 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;
@@ -326,7 +327,11 @@ public final class I18n {
     }
 
     private static URL getTranslationFile(String lang) {
-        return I18n.class.getResource("/data/"+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
@@ -225,11 +225,16 @@ public class CachedFile implements Close
         if (file == null) {
             if (name != null && name.startsWith("resource://")) {
                 String resourceName = name.substring("resource:/".length());
-                InputStream is = Utils.getResourceAsStream(getClass(), resourceName);
-                if (is == null) {
-                    throw new IOException(tr("Failed to open input stream for resource ''{0}''", name));
+                File fileRes = new File("/usr/share/josm/" + resourceName);
+                if (fileRes.exists()) {
+                    file = fileRes;
+                } else {
+                    InputStream is = Utils.getResourceAsStream(getClass(), resourceName);
+                    if (is == null) {
+                        throw new IOException(tr("Failed to open input stream for resource ''{0}''", name));
+                    }
+                    return is;
                 }
-                return is;
             } else {
                 throw new IOException("No file found for: "+name);
             }
