From: David Paleino <dapal@debian.org>
 Paul Hartmann <phaaurlt@googlemail.com>
Subject: move sharable data out of josm.jar
Origin: vendor
Forwarded: not-needed
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=698608

---
 build.xml                                     |    6 +++---
 src/org/openstreetmap/josm/io/CachedFile.java |   14 ++++++++++----
 src/org/openstreetmap/josm/tools/I18n.java    |    7 ++++++-
 3 files changed, 19 insertions(+), 8 deletions(-)

--- a/src/org/openstreetmap/josm/tools/I18n.java
+++ b/src/org/openstreetmap/josm/tools/I18n.java
@@ -7,6 +7,7 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
+import java.net.MalformedURLException;
 import java.nio.charset.StandardCharsets;
 import java.text.MessageFormat;
 import java.util.ArrayList;
@@ -317,7 +318,11 @@ public final class I18n {
     }
 
     private static URL getTranslationFile(String lang) {
-        return Main.class.getResource("/data/"+lang+".lang");
+        try {
+            return new URL("file:///usr/share/josm/data/"+lang+".lang");
+        } catch (MalformedURLException ex) {
+            return null;
+        }
     }
 
     /**
--- a/src/org/openstreetmap/josm/io/CachedFile.java
+++ b/src/org/openstreetmap/josm/io/CachedFile.java
@@ -170,11 +170,17 @@ public class CachedFile {
         File file = getFile();
         if (file == null) {
             if (name.startsWith("resource://")) {
-                InputStream is = getClass().getResourceAsStream(
+                String path = name.substring("resource://".length());
+                File fileRes = new File("/usr/share/josm/" + path);
+                if (fileRes.exists()) {
+                    file = fileRes;
+                } else {
+                    InputStream is = getClass().getResourceAsStream(
                         name.substring("resource:/".length()));
-                if (is == null)
-                    throw new IOException(tr("Failed to open input stream for resource ''{0}''", name));
-                return is;
+                    if (is == null)
+                        throw new IOException(tr("Failed to open input stream for resource ''{0}''", name));
+                    return is;
+                }
             } else throw new IOException();
         }
         return new FileInputStream(file);
--- a/build.xml
+++ b/build.xml
@@ -134,9 +134,9 @@ Debian-Release: ${debian.version}
                 <attribute name="Debian-Release" value="${debian.version}"/>
                 <attribute name="Class-Path" value="${classpathprop}"/>
             </manifest>
-            <zipfileset dir="images" prefix="images"/>
-            <zipfileset dir="data" prefix="data"/>
-            <zipfileset dir="styles" prefix="styles"/>
+            <!--<zipfileset dir="images" prefix="images"/>-->
+            <!--<zipfileset dir="data" prefix="data"/>-->
+            <!--<zipfileset dir="styles" prefix="styles"/>-->
         </jar>
     </target>
     <!-- Mac OS X target -->
