Opened 6 years ago

Last modified 6 years ago

#19343 closed enhancement

Report commands involving way/node when reporting DataIntegrityProblemException: Deleted node referenced — at Initial Version

Reported by: simon04 Owned by: team
Priority: normal Milestone: 20.06
Component: Core Version:
Keywords: Cc:

Description

  • src/org/openstreetmap/josm/data/osm/Way.java

    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 b  
    1212import java.util.stream.Collectors;
    1313import java.util.stream.IntStream;
    1414
     15import org.openstreetmap.josm.command.PseudoCommand;
     16import org.openstreetmap.josm.data.UndoRedoHandler;
    1517import org.openstreetmap.josm.data.coor.LatLon;
    1618import org.openstreetmap.josm.data.osm.visitor.OsmPrimitiveVisitor;
    1719import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor;
    private void checkNodes() {  
    532534                if (n.getDataSet() != dataSet)
    533535                    throw new DataIntegrityProblemException("Nodes in way must be in the same dataset",
    534536                            tr("Nodes in way must be in the same dataset"));
    535                 if (n.isDeleted())
    536                     throw new DataIntegrityProblemException("Deleted node referenced: " + toString(),
     537                if (n.isDeleted()) {
     538                    String commands = UndoRedoHandler.getInstance().getUndoCommands().stream()
     539                            .filter(c -> c.getParticipatingPrimitives().contains(n) || c.getParticipatingPrimitives().contains(this))
     540                            .map(PseudoCommand::getDescriptionText)
     541                            .collect(Collectors.joining(", "));
     542                    throw new DataIntegrityProblemException(String.format(
     543                            "Deleted node referenced: %s (changed by the following commands: %s)", toString(), commands),
    537544                            "<html>" + tr("Deleted node referenced by {0}",
    538545                                    DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(this)) + "</html>");
     546                }
    539547            }
    540548            if (Config.getPref().getBoolean("debug.checkNullCoor", true)) {
    541549                for (Node n: nodes) {

What do you think?

Change History (0)

Note: See TracTickets for help on using tickets.