Changeset 7796 in josm for trunk


Ignore:
Timestamp:
2014-12-12T01:28:39+01:00 (10 years ago)
Author:
Don-vip
Message:

see #10825 - handle dataset properly in mapcss tagchecker verification of assertions

Location:
trunk/src/org/openstreetmap/josm/data
Files:
3 edited

Legend:

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

    r7556 r7796  
    475475
    476476    @Override
    477     public void setDataset(DataSet dataSet) {
     477    void setDataset(DataSet dataSet) {
    478478        super.setDataset(dataSet);
    479479        checkMembers();
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r7675 r7796  
    619619
    620620    @Override
    621     public void setDataset(DataSet dataSet) {
     621    void setDataset(DataSet dataSet) {
    622622        super.setDataset(dataSet);
    623623        checkNodes();
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java

    r7713 r7796  
    3030import org.openstreetmap.josm.command.DeleteCommand;
    3131import org.openstreetmap.josm.command.SequenceCommand;
     32import org.openstreetmap.josm.data.osm.DataSet;
    3233import org.openstreetmap.josm.data.osm.OsmPrimitive;
    3334import org.openstreetmap.josm.data.osm.OsmUtils;
     
    533534     */
    534535    public synchronized Collection<TestError> getErrorsForPrimitive(OsmPrimitive p, boolean includeOtherSeverity) {
    535         final ArrayList<TestError> r = new ArrayList<>();
     536        final List<TestError> r = new ArrayList<>();
    536537        final Environment env = new Environment(p, new MultiCascade(), Environment.DEFAULT_LAYER, null);
    537538        for (Set<TagCheck> schecks : checks.values()) {
     
    628629    public Set<String> checkAsserts(final Collection<TagCheck> schecks) {
    629630        Set<String> assertionErrors = new LinkedHashSet<>();
     631        final DataSet ds = new DataSet();
    630632        for (final TagCheck check : schecks) {
    631633            if (Main.isDebugEnabled()) {
     
    637639                }
    638640                final OsmPrimitive p = OsmUtils.createPrimitive(i.getKey());
     641                // Add primitive to dataset to avoid DataIntegrityProblemException when evaluating selectors
     642                ds.addPrimitive(p);
    639643                final boolean isError = Utils.exists(getErrorsForPrimitive(p, true), new Predicate<TestError>() {
    640644                    @Override
     
    649653                    assertionErrors.add(error);
    650654                }
     655                ds.removePrimitive(p);
    651656            }
    652657        }
Note: See TracChangeset for help on using the changeset viewer.