Changeset 3032 in josm for trunk/src


Ignore:
Timestamp:
2010-02-21T13:21:46+01:00 (10 years ago)
Author:
jttt
Message:

Throw DataIntegrityProblemException when deleted primitive is referenced (has to be enabled using debug.checkDeleteReferenced property, by default it's off)

Location:
trunk/src/org/openstreetmap/josm/data/osm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/Relation.java

    r3025 r3032  
    77import java.util.Set;
    88
     9import org.openstreetmap.josm.Main;
    910import org.openstreetmap.josm.data.osm.visitor.Visitor;
    1011import org.openstreetmap.josm.tools.CopyList;
     
    382383                    throw new DataIntegrityProblemException(String.format("Relation member must be part of the same dataset as relation(%s, %s)", getPrimitiveId(), rm.getMember().getPrimitiveId()));
    383384            }
     385            if (Main.pref.getBoolean("debug.checkDeleteReferenced")) {
     386                for (RelationMember rm: members) {
     387                    if (rm.getMember().isDeleted())
     388                        throw new DataIntegrityProblemException("Deleted member referenced: " + toString());
     389                }
     390            }
    384391        }
    385392    }
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r2970 r3032  
    99import java.util.List;
    1010
     11import org.openstreetmap.josm.Main;
    1112import org.openstreetmap.josm.data.osm.visitor.Visitor;
    1213import org.openstreetmap.josm.tools.CopyList;
     
    371372                    throw new DataIntegrityProblemException("Nodes in way must be in the same dataset");
    372373            }
     374            if (Main.pref.getBoolean("debug.checkDeleteReferenced")) {
     375                for (Node n: nodes) {
     376                    if (n.isDeleted())
     377                        throw new DataIntegrityProblemException("Deleted node referenced: " + toString());
     378                }
     379            }
    373380        }
    374381    }
Note: See TracChangeset for help on using the changeset viewer.