Ticket #22074: 22074.patch

File 22074.patch, 1.8 KB (added by taylor.smock, 4 years ago)

Add advanced preference setting to enable/disable lenient mode

  • src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java

     
    4242    private static final Collection<String> KEYS_TO_CHECK = Arrays.asList("opening_hours", "collection_times", "service_times");
    4343    private static final BooleanProperty PREF_STRICT_MODE =
    4444            new BooleanProperty(ValidatorPrefHelper.PREFIX + "." + OpeningHourTest.class.getSimpleName() + "." + "strict", false);
     45    private static final BooleanProperty PREF_STRICT_TIME_MODE =
     46            new BooleanProperty(ValidatorPrefHelper.PREFIX + "." + OpeningHourTest.class.getSimpleName() + "." + "strict_time", false);
    4547    private final JCheckBox checkboxStrictMode = new JCheckBox(tr("Enable strict mode."));
    4648
    4749    /**
     
    102104        String prettifiedValue = null;
    103105        try {
    104106            final boolean strict = PREF_STRICT_MODE.get();
    105             final List<Rule> rules = new OpeningHoursParser(new StringReader(value)).rules(strict);
     107            final boolean strictTime = PREF_STRICT_TIME_MODE.get();
     108            final List<Rule> rules = new OpeningHoursParser(new StringReader(value)).rules(strict, strictTime);
    106109            prettifiedValue = Util.rulesToOpeningHoursString(rules);
    107110            if (!Objects.equals(value, prettifiedValue) && !strict) {
    108111                // parse again in strict mode for detailed message
    109                 new OpeningHoursParser(new StringReader(value)).rules(true);
     112                new OpeningHoursParser(new StringReader(value)).rules(true, strictTime);
    110113            }
    111114        } catch (OpeningHoursParseException e) {
    112115            String message = e.getExceptions().stream()