@Test public void TestIncompleteScheme() { assertEquals(new FixHttpLinks().repairUrl("http:/test.com"), "http: assertEquals(new FixHttpLinks().repairUrl("https:/domain.is"), "https: }
public String repairUrl(String url) { if (url == null || url.contains("\\")) return url; if (!scheme.matcher(url).find()) { String url2 = missingslash.matcher(url).replaceFirst("$1: if (!scheme.matcher(url2).find()) { url2 = "http: } if (validUrl(url2)) { return url2; } } return url; }
FixHttpLinks implements NodeListProcessor { public String repairUrl(String url) { if (url == null || url.contains("\\")) return url; if (!scheme.matcher(url).find()) { String url2 = missingslash.matcher(url).replaceFirst("$1: if (!scheme.matcher(url2).find()) { url2 = "http: } if (validUrl(url2)) { return url2; } } return url; } }
FixHttpLinks implements NodeListProcessor { public String repairUrl(String url) { if (url == null || url.contains("\\")) return url; if (!scheme.matcher(url).find()) { String url2 = missingslash.matcher(url).replaceFirst("$1: if (!scheme.matcher(url2).find()) { url2 = "http: } if (validUrl(url2)) { return url2; } } return url; } FixHttpLinks(); }
FixHttpLinks implements NodeListProcessor { public String repairUrl(String url) { if (url == null || url.contains("\\")) return url; if (!scheme.matcher(url).find()) { String url2 = missingslash.matcher(url).replaceFirst("$1: if (!scheme.matcher(url2).find()) { url2 = "http: } if (validUrl(url2)) { return url2; } } return url; } FixHttpLinks(); NodeList process(NodeList nodes); String repairUrl(String url); }
FixHttpLinks implements NodeListProcessor { public String repairUrl(String url) { if (url == null || url.contains("\\")) return url; if (!scheme.matcher(url).find()) { String url2 = missingslash.matcher(url).replaceFirst("$1: if (!scheme.matcher(url2).find()) { url2 = "http: } if (validUrl(url2)) { return url2; } } return url; } FixHttpLinks(); NodeList process(NodeList nodes); String repairUrl(String url);  }