Modify

Opened 4 years ago

Closed 4 years ago

#19343 closed enhancement (fixed)

Report commands involving way/node when reporting DataIntegrityProblemException: Deleted node referenced

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

Description (last modified by simon04)

  • 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? This might be helpful for debugging the many issues (query).

Attachments (0)

Change History (4)

comment:1 by simon04, 4 years ago

Description: modified (diff)

comment:2 by taylor.smock, 4 years ago

I would definitely appreciate it for my debugging purposes. When I first started working on the MapWithAI plugin, I ran into that issue a lot.

comment:3 by skyper, 4 years ago

+1

There is a similar issue with members of relations, see query.

comment:4 by simon04, 4 years ago

Resolution: fixed
Status: newclosed

In 16546/josm:

fix #19343 - DataIntegrityProblemException: report commands involving relevant primitives

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.