Changeset 18776 in josm for trunk/src


Ignore:
Timestamp:
2023-07-10T22:19:01+02:00 (17 months ago)
Author:
taylor.smock
Message:

See #23049, fix an issue where tests might visit the entire dataset during upload

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/upload/ValidateUploadHook.java

    r18775 r18776  
    1515import org.openstreetmap.josm.data.APIDataSet;
    1616import org.openstreetmap.josm.data.osm.OsmPrimitive;
    17 import org.openstreetmap.josm.data.preferences.sources.ValidatorPrefHelper;
    1817import org.openstreetmap.josm.data.validation.OsmValidator;
    19 import org.openstreetmap.josm.data.validation.Severity;
    2018import org.openstreetmap.josm.data.validation.TestError;
    2119import org.openstreetmap.josm.data.validation.ValidationTask;
     
    5351        OsmValidator.initializeTests();
    5452        new ValidationTask(errors -> {
    55             if (!Boolean.TRUE.equals(ValidatorPrefHelper.PREF_OTHER_UPLOAD.get())) {
    56                 // Use >= just in case we add additional levels.
    57                 errors.removeIf(error -> error.getSeverity().getLevel() >= Severity.OTHER.getLevel());
    58             }
    5953            if (errors.stream().allMatch(TestError::isIgnored)) {
    6054                returnCode.set(true);
  • trunk/src/org/openstreetmap/josm/data/validation/ValidationTask.java

    r18752 r18776  
    108108        }
    109109        if (this.onFinish != null) {
     110            // Remove any low severity issues if they are not desired.
     111            if (!(Boolean.TRUE.equals(ValidatorPrefHelper.PREF_OTHER.get()) &&
     112                    (!this.beforeUpload || Boolean.TRUE.equals(ValidatorPrefHelper.PREF_OTHER_UPLOAD.get())))) {
     113                // Use >= just in case we add additional levels.
     114                this.errors.removeIf(error -> error.getSeverity().getLevel() >= Severity.OTHER.getLevel());
     115            }
    110116            this.onFinish.accept(this.errors);
    111117        }
     
    125131            getProgressMonitor().setCustomText(tr("Test {0}/{1}: Starting {2}", testCounter, tests.size(), test.getName()));
    126132            test.setBeforeUpload(this.beforeUpload);
    127             test.setPartialSelection(formerValidatedPrimitives != null);
     133            // Pre-upload checks only run on a partial selection.
     134            test.setPartialSelection(this.beforeUpload || formerValidatedPrimitives != null);
    128135            test.startTest(getProgressMonitor().createSubTaskMonitor(validatedPrimitives.size(), false));
    129136            test.visit(validatedPrimitives);
Note: See TracChangeset for help on using the changeset viewer.