Changeset 15163 in josm
- Timestamp:
- 2019-06-07T11:56:58+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/scripts/SyncEditorLayerIndex.java
r15082 r15163 10 10 import java.io.OutputStreamWriter; 11 11 import java.lang.reflect.Field; 12 import java.net.MalformedURLException; 13 import java.net.URL; 12 14 import java.nio.file.Files; 13 15 import java.nio.file.Paths; … … 1081 1083 if (isNotBlank(jt) && !jt.startsWith("data:image/png;base64,")) 1082 1084 urls.add(jt); 1083 Pattern patternU = Pattern.compile("^https?://([^/]+?)(:\\d+)? /.*");1085 Pattern patternU = Pattern.compile("^https?://([^/]+?)(:\\d+)?(/.*)?"); 1084 1086 for (String u : urls) { 1085 Matcher m = patternU.matcher(u); 1086 if (!m.matches() || u.matches(".*[ \t]+$")) { 1087 if (!patternU.matcher(u).matches() || u.matches(".*[ \t]+$")) { 1087 1088 myprintln("* Strange URL '"+u+"': "+getDescription(j)); 1088 1089 } else { 1089 String domain = m.group(1).replaceAll("\\{switch:.*\\}", "x"); 1090 String port = m.group(2); 1091 if (!(domain.matches("^\\d+\\.\\d+\\.\\d+\\.\\d+$")) && !dv.isValid(domain)) 1092 myprintln("* Strange Domain '"+domain+"': "+getDescription(j)); 1093 else if (":80".equals(port) || ":443".equals(port)) { 1094 myprintln("* Useless port '"+port+"': "+getDescription(j)); 1090 try { 1091 URL jurl = new URL(u.replaceAll("\\{switch:[^\\}]*\\}", "x")); 1092 String domain = jurl.getHost(); 1093 int port = jurl.getPort(); 1094 if (!(domain.matches("^\\d+\\.\\d+\\.\\d+\\.\\d+$")) && !dv.isValid(domain)) 1095 myprintln("* Strange Domain '"+domain+"': "+getDescription(j)); 1096 else if (80 == port || 443 == port) { 1097 myprintln("* Useless port '"+port+"': "+getDescription(j)); 1098 } 1099 } catch (MalformedURLException e) { 1100 myprintln("* Malformed URL '"+u+"': "+getDescription(j)+" => "+e.getMessage()); 1095 1101 } 1096 1102 }
Note:
See TracChangeset
for help on using the changeset viewer.