- Timestamp:
- 2019-03-07T09:54:49+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r14828 r14851 27 27 import java.util.TreeSet; 28 28 import java.util.function.Predicate; 29 import java.util.regex.Pattern; 29 30 import java.util.stream.Collectors; 30 31 … … 278 279 279 280 Map<String, String> tmap = buildIgnore(buildJTreeList()); 280 if ( tmap != null &&!tmap.isEmpty()) {281 if (!tmap.isEmpty()) { 281 282 ignoredErrors.clear(); 282 283 ignoredErrors.putAll(tmap); … … 303 304 /** 304 305 * Build a JTree with a list 305 * @return < type>list as a {@code JTree}306 * @return <type>list as a {@code JTree} 306 307 */ 307 308 public static JTree buildJTreeList() { 308 309 DefaultMutableTreeNode root = new DefaultMutableTreeNode(tr("Ignore list")); 310 final Pattern elemId1Pattern = Pattern.compile(":(r|w|n)_"); 311 final Pattern elemId2Pattern = Pattern.compile("^[0-9]+$"); 309 312 for (Entry<String, String> e: ignoredErrors.entrySet()) { 310 313 String key = e.getKey(); 311 314 String value = e.getValue(); 312 315 ArrayList<String> ignoredWayList = new ArrayList<>(); 313 String[] osmobjects = key.split(":(r|w|n)_");316 String[] osmobjects = elemId1Pattern.split(key); 314 317 for (int i = 1; i < osmobjects.length; i++) { 315 318 String osmid = osmobjects[i]; 316 if ( osmid.matches("^[0-9]+$")) {319 if (elemId2Pattern.matcher(osmid).matches()) { 317 320 osmid = '_' + osmid; 318 321 int index = key.indexOf(osmid); … … 388 391 389 392 393 StringBuilder sb = new StringBuilder(); 390 394 for (int i = 0; i < model.getChildCount(node); i++) { 391 395 DefaultMutableTreeNode child = (DefaultMutableTreeNode) model.getChild(node, i); … … 393 397 String ignoreName = child.getUserObject().toString(); 394 398 if (ignoreName.matches("^(r|w|n)_.*")) { 395 osmids += ":" + child.getUserObject().toString();399 sb.append(":").append(child.getUserObject().toString()); 396 400 } else if (ignoreName.matches("^[0-9]+(_.*|)$")) { 397 401 rHashMap.put(ignoreName, description); … … 401 405 } 402 406 } 407 osmids += sb.toString(); 403 408 if (!osmids.isEmpty() && osmids.indexOf(':') != 0) rHashMap.put(osmids, description); 404 409 return rHashMap;
Note:
See TracChangeset
for help on using the changeset viewer.