Changeset 13195 in josm


Ignore:
Timestamp:
2017-12-06T18:55:54+01:00 (9 days ago)
Author:
Don-vip
Message:

fix #15641 - avoid CCE in MapCSSTagChecker

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java

    r12975 r13195  
    2424import java.util.Map;
    2525import java.util.Objects;
     26import java.util.Optional;
    2627import java.util.Set;
    2728import java.util.function.Predicate;
     
    311312                    try {
    312313                        final String val = ai.val instanceof Expression
    313                                 ? (String) ((Expression) ai.val).evaluate(new Environment())
     314                                ? Optional.of(((Expression) ai.val).evaluate(new Environment())).map(Object::toString).orElse(null)
    314315                                : ai.val instanceof String
    315316                                ? (String) ai.val
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java

    r12726 r13195  
    263263        doTestNaturalWood(14289, "example2.osm", 3, 3);
    264264    }
     265
     266    /**
     267     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/15641">Bug #15641</a>.
     268     * @throws ParseException if an error occurs
     269     */
     270    @Test
     271    public void testTicket15641() throws ParseException {
     272        assertNotNull(buildTagChecker(
     273                "relation[type=public_transport][public_transport=stop_area_group] > way {" +
     274                "  throwWarning: eval(count(parent_tags(public_transport)));" +
     275                "}"));
     276    }
    265277}
Note: See TracChangeset for help on using the changeset viewer.