Ticket #17011: 17011-suppress-dups.patch
| File 17011-suppress-dups.patch, 1.8 KB (added by , 7 years ago) |
|---|
-
src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
864 864 if (!ignoreError && !check.errors.isEmpty()) { 865 865 final TestError error = check.getErrorForPrimitive(p, r.selector, env, new MapCSSTagCheckerAndRule(check.rule)); 866 866 if (error != null) { 867 res.add(error);867 addIfNotDuplicate(error, errors); 868 868 } 869 869 } 870 870 … … 874 874 return res; 875 875 } 876 876 877 private static void addIfNotDuplicate(TestError toAdd, List<TestError> errors) { 878 boolean isDup = false; 879 if (toAdd.getPrimitives().size() >= 2) { 880 // make sure that we don't report the same error for the same combination of primitives in different order 881 for (TestError e : errors) { 882 if (e.getCode() == toAdd.getCode() && e.getMessage().equals(toAdd.getMessage()) 883 && e.getPrimitives().size() == toAdd.getPrimitives().size() 884 && e.getPrimitives().containsAll(toAdd.getPrimitives())) { 885 isDup = true; 886 break; 887 } 888 } 889 } 890 if (!isDup) 891 errors.add(toAdd); 892 } 893 877 894 private static Collection<TestError> getErrorsForPrimitive(OsmPrimitive p, boolean includeOtherSeverity, 878 895 Collection<Set<TagCheck>> checksCol) { 879 896 final List<TestError> r = new ArrayList<>();
