Changeset 7698 in josm for trunk/src


Ignore:
Timestamp:
2014-11-02T23:01:57+01:00 (9 years ago)
Author:
Don-vip
Message:

fix #10696 - Provide a fix for website's with no scheme (patch by brianegge)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java

    r7489 r7698  
    157157    private static final Pattern PORT_PATTERN = Pattern.compile(PORT_REGEX);
    158158
     159    private static final String SIMPLE_WEBSITE = "^www[.].*";
     160    private static final Pattern SIMPLE_WEBSITE_PATTERN = Pattern.compile(SIMPLE_WEBSITE);
     161
    159162    /**
    160163     * Holds the set of current validation options.
     
    298301        if (!isValidScheme(scheme)) {
    299302            setErrorMessage(tr("URL contains an invalid protocol: {0}", scheme));
     303            if (SIMPLE_WEBSITE_PATTERN.matcher(value).matches()) {
     304                setFix("http://" + value);
     305            }
    300306            return false;
    301307        }
Note: See TracChangeset for help on using the changeset viewer.