﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
19343	Report commands involving way/node when reporting  DataIntegrityProblemException: Deleted node referenced	simon04	team	"{{{
#!patch
diff --git a/src/org/openstreetmap/josm/data/osm/Way.java b/src/org/openstreetmap/josm/data/osm/Way.java
index df2ee3cbc..37122d6f1 100644
--- a/src/org/openstreetmap/josm/data/osm/Way.java
+++ b/src/org/openstreetmap/josm/data/osm/Way.java
@@ -12,6 +12,8 @@
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 
+import org.openstreetmap.josm.command.PseudoCommand;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.visitor.OsmPrimitiveVisitor;
 import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor;
@@ -532,10 +534,16 @@ private void checkNodes() {
                 if (n.getDataSet() != dataSet)
                     throw new DataIntegrityProblemException(""Nodes in way must be in the same dataset"",
                             tr(""Nodes in way must be in the same dataset""));
-                if (n.isDeleted())
-                    throw new DataIntegrityProblemException(""Deleted node referenced: "" + toString(),
+                if (n.isDeleted()) {
+                    String commands = UndoRedoHandler.getInstance().getUndoCommands().stream()
+                            .filter(c -> c.getParticipatingPrimitives().contains(n) || c.getParticipatingPrimitives().contains(this))
+                            .map(PseudoCommand::getDescriptionText)
+                            .collect(Collectors.joining("", ""));
+                    throw new DataIntegrityProblemException(String.format(
+                            ""Deleted node referenced: %s (changed by the following commands: %s)"", toString(), commands),
                             ""<html>"" + tr(""Deleted node referenced by {0}"",
                                     DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(this)) + ""</html>"");
+                }
             }
             if (Config.getPref().getBoolean(""debug.checkNullCoor"", true)) {
                 for (Node n: nodes) {
}}}

What do you think?"	enhancement	new	normal	20.06	Core				
