Changeset 9693 in josm


Ignore:
Timestamp:
2016-01-31T11:28:22+01:00 (8 years ago)
Author:
simon04
Message:

fix #12464 see #12464 - Regression: Validator did not longer warn about nodes without tags

Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java

    r9397 r9693  
    14251425        }
    14261426
    1427         protected abstract Collection<Bounds> getBounds();
     1427        protected abstract Collection<Bounds> getBounds(OsmPrimitive primitive);
    14281428
    14291429        @Override
     
    14321432                return false;
    14331433            else if (osm instanceof Node) {
    1434                 Collection<Bounds> allBounds = getBounds();
     1434                Collection<Bounds> allBounds = getBounds(osm);
    14351435                if (allBounds != null) {
    14361436                    LatLon coor = ((Node) osm).getCoor();
     
    14671467
    14681468        @Override
    1469         protected Collection<Bounds> getBounds() {
    1470             return Main.main == null || Main.main.getCurrentDataSet() == null || Main.main.getCurrentDataSet().getDataSourceArea() == null
    1471                     ? null : Main.main.getCurrentDataSet().getDataSourceBounds();
     1469        protected Collection<Bounds> getBounds(OsmPrimitive primitive) {
     1470            return primitive.getDataSet() != null ? primitive.getDataSet().getDataSourceBounds() : null;
    14721471        }
    14731472
     
    14801479    /**
    14811480     * Matches objects which are not outside the source area ("downloaded area").
    1482      * Unlink {@link InDataSourceArea} this matches also if no source area is set (e.g., for new layers).
     1481     * Unlike {@link InDataSourceArea} this matches also if no source area is set (e.g., for new layers).
    14831482     */
    14841483    public static class NotOutsideDataSourceArea extends InDataSourceArea {
     
    14921491
    14931492        @Override
    1494         protected Collection<Bounds> getBounds() {
    1495             final Collection<Bounds> bounds = super.getBounds();
     1493        protected Collection<Bounds> getBounds(OsmPrimitive primitive) {
     1494            final Collection<Bounds> bounds = super.getBounds(primitive);
    14961495            return bounds == null || bounds.isEmpty() ? Collections.singleton(Main.getProjection().getWorldBoundsLatLon()) : bounds;
    14971496        }
     
    15131512
    15141513        @Override
    1515         protected Collection<Bounds> getBounds() {
     1514        protected Collection<Bounds> getBounds(OsmPrimitive primitive) {
    15161515            if (!Main.isDisplayingMapView()) {
    15171516                return null;
  • trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedNode.java

    r9604 r9693  
    4141        if (n.isUsable() && !n.isTagged() && n.getReferrers().isEmpty()) {
    4242
    43             if (!n.hasKeys() && !IN_DOWNLOADED_AREA.evaluate(n)) {
     43            if (!n.hasKeys() && IN_DOWNLOADED_AREA.evaluate(n)) {
    4444                String msg = marktr("No tags");
    4545                errors.add(new TestError(this, Severity.WARNING, ERROR_MESSAGE, tr(msg), msg, UNTAGGED_NODE_BLANK, n));
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UntaggedNodeTest.java

    r9666 r9693  
    22package org.openstreetmap.josm.data.validation.tests;
    33
     4import static org.CustomMatchers.hasSize;
    45import static org.CustomMatchers.isEmpty;
    56import static org.junit.Assert.assertThat;
     
    4647        }
    4748    }
     49
     50    /**
     51     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/12464">Bug #12464</a>.
     52     * @throws Exception if an error occurs
     53     */
     54    @Test
     55    public void testTicket12464() throws Exception {
     56        test.initialize();
     57        test.startTest(null);
     58        try (InputStream fis = TestUtils.getRegressionDataStream(12464, "example.osm")) {
     59            final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
     60            test.visit(ds.allPrimitives());
     61            test.endTest();
     62            assertThat(test.getErrors(), hasSize(1));
     63        }
     64    }
    4865}
Note: See TracChangeset for help on using the changeset viewer.