Changeset 16178 in josm for trunk/src/org
- Timestamp:
- 2020-03-20T21:06:06+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/validation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/TestError.java
r15939 r16178 220 220 * 221 221 * @return a new test error with the specified values 222 * @throws IllegalArgumentException when {@link #message} or {@link #primitives} is null /empty.222 * @throws IllegalArgumentException when {@link #message} or {@link #primitives} is null. 223 223 */ 224 224 public TestError build() { 225 225 CheckParameterUtil.ensureParameterNotNull(message, "message not set"); 226 226 CheckParameterUtil.ensureParameterNotNull(primitives, "primitives not set"); 227 CheckParameterUtil.ensureThat(!primitives.isEmpty(), "primitives is empty");228 227 if (this.highlighted == null) { 229 228 this.highlighted = Collections.emptySet(); -
trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java
r16154 r16178 46 46 * @param message The error message 47 47 * @param key The incriminated key, used for display. 48 * @param value The incriminated value, used for comparison with prettified value. 48 49 * @param prettifiedValue The prettified value 49 50 * @param p The incriminated OSM primitive. 50 51 * @return The real test error given to JOSM validator. Can be fixable or not if a prettified values has been determined. 51 52 */ 52 private TestError createTestError(Severity severity, String message, String key, String prettifiedValue, OsmPrimitive p) {53 private TestError createTestError(Severity severity, String message, String key, String value, String prettifiedValue, OsmPrimitive p) { 53 54 final TestError.Builder error = TestError.builder(this, severity, 2901) 54 55 .message(tr("Opening hours syntax"), message) // todo obtain English message for ignore functionality 55 .primitives(p );56 if (p rettifiedValue == null || prettifiedValue.equals(p.get(key))) {56 .primitives(p != null ? new OsmPrimitive[] {p} : new OsmPrimitive[] {}); 57 if (p == null || prettifiedValue == null || prettifiedValue.equals(value)) { 57 58 return error.build(); 58 59 } else { … … 96 97 } 97 98 } catch (ParseException e) { 98 return Collections.singletonList(createTestError(Severity.WARNING, e.getMessage(), key, prettifiedValue, p));99 return Collections.singletonList(createTestError(Severity.WARNING, e.getMessage(), key, value, prettifiedValue, p)); 99 100 } 100 101 101 if (!includeOtherSeverityChecks() || Objects.equals(value, prettifiedValue) || p == null) {102 if (!includeOtherSeverityChecks() || Objects.equals(value, prettifiedValue)) { 102 103 return Collections.emptyList(); 103 104 } else { 104 105 final String message = tr("{0} value can be prettified", key); 105 return Collections.singletonList(createTestError(Severity.OTHER, message, key, prettifiedValue, p));106 return Collections.singletonList(createTestError(Severity.OTHER, message, key, value, prettifiedValue, p)); 106 107 } 107 108 }
Note:
See TracChangeset
for help on using the changeset viewer.