[Pkg-osm-commits] [SCM] josm branch, master, updated. debian/0.0.svn6502+dfsg1-1-21-g413ac40
David Paleino
dapal at debian.org
Thu Mar 6 18:06:28 UTC 2014
The following commit has been merged in the master branch:
commit 025ab3d2e87e37614f8b97859c9d057578b013b9
Author: David Paleino <dapal at debian.org>
Date: Thu Mar 6 00:55:14 2014 +0100
Fix FTBFS
diff --git a/debian/patches/08-use_external_json_library.patch b/debian/patches/08-use_external_json_library.patch
index 863bb32..88189ad 100644
--- a/debian/patches/08-use_external_json_library.patch
+++ b/debian/patches/08-use_external_json_library.patch
@@ -5,9 +5,11 @@ Origin: vendor
Forwarded: no
---
- CONTRIBUTION | 6 +-----
- build.xml | 1 +
- 2 files changed, 2 insertions(+), 5 deletions(-)
+ CONTRIBUTION | 6 ----
+ build.xml | 1
+ src/org/openstreetmap/josm/io/GeoJSONExporter.java | 8 ++++-
+ src/org/openstreetmap/josm/io/GeoJSONWriter.java | 31 +++++++++++++--------
+ 4 files changed, 29 insertions(+), 17 deletions(-)
--- josm.orig/build.xml
+++ josm/build.xml
@@ -34,3 +36,112 @@ Forwarded: no
-with the New (2-clause) BSD license.
\ No newline at end of file
+with the New (2-clause) BSD license.
+--- josm.orig/src/org/openstreetmap/josm/io/GeoJSONWriter.java
++++ josm/src/org/openstreetmap/josm/io/GeoJSONWriter.java
+@@ -5,6 +5,7 @@ import java.util.Iterator;
+ import java.util.Map;
+ import java.util.Map.Entry;
+
++import org.json.JSONException;
+ import org.json.JSONStringer;
+ import org.openstreetmap.josm.data.Bounds;
+ import org.openstreetmap.josm.data.coor.LatLon;
+@@ -26,7 +27,7 @@ public class GeoJSONWriter implements Vi
+ this.layer = layer;
+ }
+
+- public String write() {
++ public String write() throws JSONException {
+ out = new JSONStringer();
+ out.object().key("type").value("FeatureCollection");
+ out.key("generator").value("JOSM");
+@@ -44,17 +45,25 @@ public class GeoJSONWriter implements Vi
+
+ @Override
+ public void visit(Node n) {
+- out.key("type").value("Point").key("coordinates");
+- appendCoord(n.getCoor());
++ try {
++ out.key("type").value("Point").key("coordinates");
++ appendCoord(n.getCoor());
++ } catch (JSONException ex) {
++ throw new RuntimeException(ex);
++ }
+ }
+
+ @Override
+ public void visit(Way w) {
+- out.key("type").value("LineString").key("coordinates").array();
+- for (Node n : w.getNodes()) {
+- appendCoord(n.getCoor());
++ try {
++ out.key("type").value("LineString").key("coordinates").array();
++ for (Node n : w.getNodes()) {
++ appendCoord(n.getCoor());
++ }
++ out.endArray();
++ } catch (JSONException ex) {
++ throw new RuntimeException(ex);
+ }
+- out.endArray();
+ }
+
+ @Override
+@@ -65,7 +74,7 @@ public class GeoJSONWriter implements Vi
+ public void visit(Changeset cs) {
+ }
+
+- protected void appendPrimitive(OsmPrimitive p) {
++ protected void appendPrimitive(OsmPrimitive p) throws JSONException {
+ if (p.isIncomplete()) {
+ return;
+ } else if (skipEmptyNodes && p instanceof Node && p.getKeys().isEmpty()) {
+@@ -85,13 +94,13 @@ public class GeoJSONWriter implements Vi
+ out.endObject();
+ }
+
+- protected void appendCoord(LatLon c) {
++ protected void appendCoord(LatLon c) throws JSONException {
+ if (c != null) {
+ out.array().value(c.lon()).value(c.lat()).endArray();
+ }
+ }
+
+- protected void appendLayerBounds() {
++ protected void appendLayerBounds() throws JSONException {
+ Iterator<Bounds> it = layer.data.getDataSourceBounds().iterator();
+ if (it.hasNext()) {
+ Bounds b = new Bounds(it.next());
+@@ -102,7 +111,7 @@ public class GeoJSONWriter implements Vi
+ }
+ }
+
+- protected void appendBounds(Bounds b) {
++ protected void appendBounds(Bounds b) throws JSONException {
+ if (b != null) {
+ out.key("bbox").array()
+ .value(b.getMinLon()).value(b.getMinLat())
+--- josm.orig/src/org/openstreetmap/josm/io/GeoJSONExporter.java
++++ josm/src/org/openstreetmap/josm/io/GeoJSONExporter.java
+@@ -10,6 +10,7 @@ import java.io.IOException;
+ import java.io.OutputStreamWriter;
+ import java.io.Writer;
+
++import org.json.JSONException;
+ import org.openstreetmap.josm.actions.ExtensionFileFilter;
+ import org.openstreetmap.josm.gui.layer.Layer;
+ import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+@@ -27,7 +28,12 @@ public class GeoJSONExporter extends Fil
+ @Override
+ public void exportData(File file, Layer layer) throws IOException {
+ if (layer instanceof OsmDataLayer) {
+- String json = new GeoJSONWriter((OsmDataLayer) layer).write();
++ String json = "";
++ try {
++ json = new GeoJSONWriter((OsmDataLayer) layer).write();
++ } catch (JSONException ex) {
++ throw new RuntimeException(ex);
++ }
+ Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
+ try {
+ out.write(json);
--
Editor for OpenStreetMap
More information about the Pkg-osm-commits
mailing list