The following commit has been merged in the master branch:
commit ca22ceef2d1aad36db3fc6af9748c2416648a9ee
Author: David Paleino <da...@debian.org>
Date:   Fri Apr 5 10:28:10 2013 +0200

    Make 06-move_data_out_of_jar.patch more generic, thanks to Paul Hartmann 
for the patch. (Closes: #698608)

diff --git a/debian/changelog b/debian/changelog
index 707c515..52e3f9e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,10 @@
 josm (0.0.svn5759+dfsg1-1) UNRELEASED; urgency=low
 
   * New tested snapshot.
+  * Make 06-move_data_out_of_jar.patch more generic, thanks to
+    Paul Hartmann for the patch. (Closes: #698608)
 
- -- David Paleino <da...@debian.org>  Fri, 05 Apr 2013 10:21:52 +0200
+ -- David Paleino <da...@debian.org>  Fri, 05 Apr 2013 10:27:11 +0200
 
 josm (0.0.svn5608+dfsg1-2) unstable; urgency=low
 
diff --git a/debian/patches/06-move_data_out_of_jar.patch 
b/debian/patches/06-move_data_out_of_jar.patch
index 5ef77c8..899277e 100644
--- a/debian/patches/06-move_data_out_of_jar.patch
+++ b/debian/patches/06-move_data_out_of_jar.patch
@@ -1,20 +1,15 @@
 From: David Paleino <da...@debian.org>
+ Paul Hartmann <phaau...@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/data/Preferences.java                              
 |    2 +-
- src/org/openstreetmap/josm/data/projection/Projections.java                   
 |    2 +-
- 
src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFileWrapper.java 
|    4 ++--
- src/org/openstreetmap/josm/data/validation/tests/TagChecker.java              
 |    6 +++---
- src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java               
 |    2 +-
- src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java        
 |    4 ++--
- src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java   
 |    2 +-
- src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java                     
 |    2 +-
- src/org/openstreetmap/josm/tools/I18n.java                                    
 |    7 ++++++-
- 10 files changed, 21 insertions(+), 16 deletions(-)
+ build.xml                                              |    6 ++---
+ src/org/openstreetmap/josm/io/MirroredInputStream.java |   19 
+++++++++++------
+ src/org/openstreetmap/josm/tools/I18n.java             |    7 +++++-
+ 3 files changed, 22 insertions(+), 10 deletions(-)
 
 --- josm.orig/build.xml
 +++ josm/build.xml
@@ -31,106 +26,6 @@ Forwarded: not-needed
              <zipfileset dir="src/org/openstreetmap/gui/jmapviewer/images" 
prefix="org/openstreetmap/gui/jmapviewer/images"/>
              <!-- All jar files necessary to run only JOSM (no tests) -->
              <!-- <zipfileset src="lib/metadata-extractor-2.3.1-nosun.jar"/>  
-->
---- josm.orig/src/org/openstreetmap/josm/data/Preferences.java
-+++ josm/src/org/openstreetmap/josm/data/Preferences.java
-@@ -1519,7 +1519,7 @@ public class Preferences {
- 
-     public void validateXML(Reader in) throws Exception {
-         SchemaFactory factory =  
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
--        Schema schema = factory.newSchema(new StreamSource(new 
MirroredInputStream("resource://data/preferences.xsd")));
-+        Schema schema = factory.newSchema(new StreamSource(new 
MirroredInputStream("/usr/share/josm/data/preferences.xsd")));
-         Validator validator = schema.newValidator();
-         validator.validate(new StreamSource(in));
-     }
---- josm.orig/src/org/openstreetmap/josm/data/projection/Projections.java
-+++ josm/src/org/openstreetmap/josm/data/projection/Projections.java
-@@ -124,7 +124,7 @@ public class Projections {
-     private static void loadInits() {
-         Pattern epsgPattern = Pattern.compile("<(\\d+)>(.*)<>");
-         try {
--            InputStream in = new MirroredInputStream("resource://data/epsg");
-+            InputStream in = new 
MirroredInputStream("/usr/share/josm/data/epsg");
-             BufferedReader r = new BufferedReader(new InputStreamReader(in));
-             String line, lastline = "";
-             while ((line = r.readLine()) != null) {
---- 
josm.orig/src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java
-+++ 
josm/src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java
-@@ -317,7 +317,7 @@ public class TaggingPresetPreference imp
- 
-         @Override
-         public Collection<ExtendedSourceEntry> getDefault() {
--            ExtendedSourceEntry i = new 
ExtendedSourceEntry("defaultpresets.xml", "resource://data/defaultpresets.xml");
-+            ExtendedSourceEntry i = new 
ExtendedSourceEntry("defaultpresets.xml", 
"/usr/share/josm/data/defaultpresets.xml");
-             i.title = tr("Internal Preset");
-             i.description = tr("The default preset for JOSM");
-             return Collections.singletonList(i);
---- josm.orig/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
-+++ josm/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
-@@ -68,9 +68,9 @@ import org.openstreetmap.josm.tools.Mult
- public class TagChecker extends Test
- {
-     /** The default data files */
--    public static final String DATA_FILE = "resource://data/tagchecker.cfg";
--    public static final String IGNORE_FILE = "resource://data/ignoretags.cfg";
--    public static final String SPELL_FILE = "resource://data/words.cfg";
-+    public static final String DATA_FILE = 
"/usr/share/josm/data/tagchecker.cfg";
-+    public static final String IGNORE_FILE = 
"/usr/share/josm/data/ignoretags.cfg";
-+    public static final String SPELL_FILE = "/usr/share/josm/data/words.cfg";
- 
-     /** The spell check key substitutions: the key should be substituted by 
the value */
-     protected static Map<String, String> spellCheckKeyData;
---- 
josm.orig/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java
-+++ josm/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java
-@@ -237,12 +237,12 @@ public class MapPaintPreference implemen
- 
-         @Override
-         public Collection<ExtendedSourceEntry> getDefault() {
--            ExtendedSourceEntry defJOSM = new 
ExtendedSourceEntry("elemstyles.xml", 
"resource://styles/standard/elemstyles.xml");
-+            ExtendedSourceEntry defJOSM = new 
ExtendedSourceEntry("elemstyles.xml", 
"/usr/share/josm/styles/standard/elemstyles.xml");
-             defJOSM.active = true;
-             defJOSM.name = "standard";
-             defJOSM.title = tr("JOSM Internal Style");
-             defJOSM.description = tr("Internal style to be used as base for 
runtime switchable overlay styles");
--            ExtendedSourceEntry defPL2 = new 
ExtendedSourceEntry("potlatch2.mapcss", 
"resource://styles/standard/potlatch2.mapcss");
-+            ExtendedSourceEntry defPL2 = new 
ExtendedSourceEntry("potlatch2.mapcss", 
"/usr/share/josm/styles/standard/potlatch2.mapcss");
-             defPL2.active = false;
-             defPL2.name = "standard";
-             defPL2.title = tr("Potlatch 2");
---- 
josm.orig/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFileWrapper.java
-+++ 
josm/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFileWrapper.java
-@@ -15,8 +15,8 @@ import org.openstreetmap.josm.io.Mirrore
-  */
- public class NTV2GridShiftFileWrapper {
- 
--    public final static NTV2GridShiftFileWrapper BETA2007 = new 
NTV2GridShiftFileWrapper("resource://data/BETA2007.gsb");
--    public final static NTV2GridShiftFileWrapper ntf_rgf93 = new 
NTV2GridShiftFileWrapper("resource://data/ntf_r93_b.gsb");
-+    public final static NTV2GridShiftFileWrapper BETA2007 = new 
NTV2GridShiftFileWrapper("/usr/share/josm/data/BETA2007.gsb");
-+    public final static NTV2GridShiftFileWrapper ntf_rgf93 = new 
NTV2GridShiftFileWrapper("/usr/share/josm/data/ntf_r93_b.gsb");
-     
- 
-     private NTV2GridShiftFile instance = null;
---- josm.orig/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
-+++ josm/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
-@@ -70,7 +70,7 @@ public class XmlStyleSource extends Styl
-             XmlObjectParser parser = new XmlObjectParser(new 
XmlStyleSourceHandler(this));
-             parser.startWithValidation(reader,
-                     "http://josm.openstreetmap.de/mappaint-style-1.0";,
--                    "resource://data/mappaint-style.xsd");
-+                    "/usr/share/josm/data/mappaint-style.xsd");
-             while(parser.hasNext()) {
-             }
- 
---- josm.orig/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
-+++ josm/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
-@@ -1505,7 +1505,7 @@ public class TaggingPreset extends Abstr
-         List<PresetListEntry> listEntries = new LinkedList<PresetListEntry>();
- 
-         if (validate) {
--            parser.startWithValidation(in, 
"http://josm.openstreetmap.de/tagging-preset-1.0";, 
"resource://data/tagging-preset.xsd");
-+            parser.startWithValidation(in, 
"http://josm.openstreetmap.de/tagging-preset-1.0";, 
"/usr/share/josm/data/tagging-preset.xsd");
-         } else {
-             parser.start(in);
-         }
 --- josm.orig/src/org/openstreetmap/josm/tools/I18n.java
 +++ josm/src/org/openstreetmap/josm/tools/I18n.java
 @@ -7,6 +7,7 @@ import java.io.FileInputStream;
@@ -154,3 +49,32 @@ Forwarded: not-needed
      }
  
      /**
+--- josm.orig/src/org/openstreetmap/josm/io/MirroredInputStream.java
++++ josm/src/org/openstreetmap/josm/io/MirroredInputStream.java
+@@ -81,13 +81,20 @@ public class MirroredInputStream extends
+             }
+         } catch (java.net.MalformedURLException e) {
+             if (name.startsWith("resource://")) {
+-                fs = getClass().getResourceAsStream(
+-                        name.substring("resource:/".length()));
+-                if (fs == null)
+-                    throw new IOException(tr("Failed to open input stream for 
resource ''{0}''", name));
+-                return;
++                String path = name.substring("resource://".length());
++                File fileRes = new File("/usr/share/josm/" + path);
++                if (fileRes.exists()) {
++                    file = fileRes;
++                } else {
++                    fs = getClass().getResourceAsStream(
++                            name.substring("resource:/".length()));
++                    if (fs == null)
++                        throw new IOException(tr("Failed to open input stream 
for resource ''{0}''", name));
++                    return;
++                }
+             }
+-            file = new File(name);
++            if (file == null)
++                file = new File(name);
+         }
+         if (file == null)
+             throw new IOException();

-- 
Editor for OpenStreetMap

_______________________________________________
Pkg-osm-commits mailing list
Pkg-osm-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-osm-commits

Reply via email to