Index: trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 2414)
+++ trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 2415)
@@ -385,6 +385,11 @@
         if (version <= 0)
             throw new IllegalArgumentException(tr("Version > 0 expected. Got {0}.", version));
-        if (dataSet != null && id != this.id)
-            throw new DataIntegrityProblemException("Id cannot be changed after primitive was added to the dataset");
+        if (dataSet != null && id != this.id) {
+            DataSet datasetCopy = dataSet;
+            // Reindex primitive
+            datasetCopy.removePrimitive(this);
+            this.id = id;
+            datasetCopy.addPrimitive(this);
+        }
         this.id = id;
         this.version = version;
