Changeset 7902 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2014-12-28T18:59:56+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/validation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java
r7779 r7902 157 157 private static final Pattern PORT_PATTERN = Pattern.compile(PORT_REGEX); 158 158 159 private static final String SIMPLE_WEBSITE = "^www[.].*";160 private static final Pattern SIMPLE_WEBSITE_PATTERN = Pattern.compile(SIMPLE_WEBSITE);161 162 159 /** 163 160 * Holds the set of current validation options. … … 301 298 if (!isValidScheme(scheme)) { 302 299 setErrorMessage(tr("URL contains an invalid protocol: {0}", scheme)); 303 if (SIMPLE_WEBSITE_PATTERN.matcher(value).matches()) {304 setFix("http://" + value);305 }306 300 return false; 307 301 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/InternetTags.java
r7824 r7902 128 128 private TestError doValidateTag(OsmPrimitive p, String k, String v, AbstractValidator validator, int code) { 129 129 TestError error = null; 130 if (!validator.isValid(v != null ? v : p.get(k))) { 131 String msg = tr("''{0}'': {1}", k, validator.getErrorMessage()); 130 String value = v != null ? v : p.get(k); 131 if (!validator.isValid(value)) { 132 String errMsg = validator.getErrorMessage(); 133 // Special treatment to allow URLs without protocol. See UrlValidator#isValid 134 if (tr("URL contains an invalid protocol: {0}", (String)null).equals(errMsg)) { 135 String proto = validator instanceof EmailValidator ? "mailto://" : "http://"; 136 return doValidateTag(p, k, proto+value, validator, code); 137 } 138 String msg = tr("''{0}'': {1}", k, errMsg); 132 139 String fix = validator.getFix(); 133 140 if (fix != null) {
Note:
See TracChangeset
for help on using the changeset viewer.