From: Don-vip
Subject: handle redacted objects resulting from OSM License change process
Origin: upstream, http://josm.openstreetmap.de/changeset/5339/josm
 upstream, http://josm.openstreetmap.de/changeset/5340/josm
Bug-Debian: http://bugs.debian.org/682315

---
 src/org/openstreetmap/josm/data/osm/history/History.java        |   14 ++++++++++
 src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java |    5 +++
 2 files changed, 19 insertions(+)

--- josm.orig/src/org/openstreetmap/josm/data/osm/history/History.java
+++ josm/src/org/openstreetmap/josm/data/osm/history/History.java
@@ -230,4 +230,18 @@ public class History{
     public OsmPrimitiveType getType() {
         return type;
     }
+
+    @Override
+    public String toString() {
+        String result = "History ["
+                + (type != null ? "type=" + type + ", " : "") + "id=" + id;
+        if (versions != null) {
+            result += ", versions=\n";
+            for (HistoryOsmPrimitive v : versions) {
+                result += "\t" + v + ",\n";
+            }
+        }
+        result += "]";
+        return result;
+    }
 }
--- josm.orig/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java
+++ josm/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java
@@ -161,6 +161,11 @@ public class HistoryBrowserModel extends
         if (history.getByVersion(primitive.getVersion()) != null)
             return primitive.isModified();
 
+        // if latest version from history is higher than a non existing primitive version,
+        // that means this version has been redacted and the primitive cannot be used.
+        if (history.getLatest().getVersion() > primitive.getVersion())
+            return false;
+
         // latest has a higher version than one of the primitives
         // in the history (probably because the history got out of sync
         // with uploaded data) -> show the primitive as latest
