Changeset 6415 in josm for trunk/src/org


Ignore:
Timestamp:
2013-11-26T02:15:33+01:00 (11 years ago)
Author:
Don-vip
Message:

fix #9364 - service_times reported as "opening_hours - (...)" in validator

File:
1 edited

Legend:

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

    r6379 r6415  
    150150     * <a href="https://github.com/ypid/opening_hours.js">opening_hours.js</a> and returns a list containing
    151151     * validation errors or an empty list. Null values result in an empty list.
     152     * @param key the OSM key (should be "opening_hours", "collection_times" or "service_times"). Used in error message
    152153     * @param value the opening hour value to be checked.
    153154     * @param mode whether to validate {@code value} as a time range, or points in time, or both.
    154155     * @return a list of {@link TestError} or an empty list
    155156     */
    156     public List<OpeningHoursTestError> checkOpeningHourSyntax(final String value, CheckMode mode) {
     157    public List<OpeningHoursTestError> checkOpeningHourSyntax(final String key, final String value, CheckMode mode) {
    157158        if (ENGINE == null || value == null || value.trim().isEmpty()) {
    158159            return Collections.emptyList();
     
    173174        } catch (ScriptException ex) {
    174175            final String message = ex.getMessage()
    175                     .replaceAll("[^:]*Exception: ", "opening_hours - ")
     176                    .replaceAll("[^:]*Exception: ", key+" - ")
    176177                    .replaceAll("\\(<Unknown source.*", "")
    177178                    .trim();
     
    182183    }
    183184
    184     public List<OpeningHoursTestError> checkOpeningHourSyntax(final String value) {
    185         return checkOpeningHourSyntax(value, CheckMode.TIME_RANGE);
     185    public List<OpeningHoursTestError> checkOpeningHourSyntax(final String key, final String value) {
     186        return checkOpeningHourSyntax(key, value, CheckMode.TIME_RANGE);
    186187    }
    187188
    188189    protected void check(final OsmPrimitive p, final String key, CheckMode mode) {
    189         for (OpeningHoursTestError e : checkOpeningHourSyntax(p.get(key), mode)) {
     190        for (OpeningHoursTestError e : checkOpeningHourSyntax(key, p.get(key), mode)) {
    190191            errors.add(e.getTestError(p, key));
    191192        }
Note: See TracChangeset for help on using the changeset viewer.