Changeset 2970 in josm


Ignore:
Timestamp:
2010-02-12T23:02:35+01:00 (15 years ago)
Author:
jttt
Message:

Throw DataIntergrityException also when Way/Relation with broken member references is added to the dataset

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

Legend:

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

    r2963 r2970  
    344344    }
    345345
    346     private void fireMembersChanged() {
     346    @Override
     347    public void setDataset(DataSet dataSet) {
     348        super.setDataset(dataSet);
     349        checkMembers();
     350    }
     351
     352    private void checkMembers() {
    347353        DataSet dataSet = getDataSet();
    348354        if (dataSet != null) {
     
    351357                    throw new DataIntegrityProblemException("Relation member must be part of the same dataset as relation");
    352358            }
    353             dataSet.fireRelationMembersChanged(this);
     359        }
     360    }
     361
     362    private void fireMembersChanged() {
     363        checkMembers();
     364        if (getDataSet() != null) {
     365            getDataSet().fireRelationMembersChanged(this);
    354366        }
    355367    }
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r2963 r2970  
    364364    }
    365365
    366     private void fireNodesChanged() {
     366    private void checkNodes() {
    367367        DataSet dataSet = getDataSet();
    368368        if (dataSet != null) {
     
    371371                    throw new DataIntegrityProblemException("Nodes in way must be in the same dataset");
    372372            }
     373        }
     374    }
     375
     376    private void fireNodesChanged() {
     377        checkNodes();
     378        if (getDataSet() != null) {
    373379            getDataSet().fireWayNodesChanged(this);
    374380        }
     381    }
     382
     383    @Override
     384    public void setDataset(DataSet dataSet) {
     385        super.setDataset(dataSet);
     386        checkNodes();
    375387    }
    376388
Note: See TracChangeset for help on using the changeset viewer.