Changeset 17585 in josm for trunk/src/org/openstreetmap/josm/data/validation/tests/ConditionalKeys.java
- Timestamp:
- 2021-03-18T00:57:09+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/ConditionalKeys.java
r17434 r17585 18 18 import org.openstreetmap.josm.data.validation.TestError; 19 19 import org.openstreetmap.josm.tools.Logging; 20 import org.openstreetmap.josm.tools.SubclassFilteredCollection;21 20 22 21 /** … … 224 223 public List<TestError> validatePrimitive(OsmPrimitive p) { 225 224 final List<TestError> errors = new ArrayList<>(); 226 for (final String key : SubclassFilteredCollection.filter(p.keySet(), 227 Pattern.compile(":conditional(:.*)?$").asPredicate())) { 225 final Pattern pattern = Pattern.compile(":conditional(:.*)?$"); 226 p.visitKeys((primitive, key, value) -> { 227 if (!pattern.matcher(key).find()) { 228 return; 229 } 228 230 if (!isKeyValid(key)) { 229 231 errors.add(TestError.builder(this, Severity.WARNING, 3201) … … 231 233 .primitives(p) 232 234 .build()); 233 continue; 234 } 235 final String value = p.get(key); 235 return; 236 } 236 237 final String error = validateValue(key, value); 237 238 if (error != null) { … … 241 242 .build()); 242 243 } 243 } 244 }); 244 245 return errors; 245 246 }
Note:
See TracChangeset
for help on using the changeset viewer.