|
28 | 28 | import java.io.IOException;
|
29 | 29 | import java.lang.reflect.Field;
|
30 | 30 | import java.lang.reflect.InvocationTargetException;
|
| 31 | +import java.net.MalformedURLException; |
| 32 | +import java.net.URI; |
| 33 | +import java.net.URISyntaxException; |
31 | 34 | import java.nio.file.Paths;
|
32 | 35 | import java.text.ParseException;
|
33 | 36 | import java.util.ArrayList;
|
|
46 | 49 | import java.util.logging.Logger;
|
47 | 50 | import java.util.stream.Collectors;
|
48 | 51 |
|
49 |
| -import org.apache.commons.validator.routines.UrlValidator; |
50 | 52 | import org.opengrok.indexer.Info;
|
51 | 53 | import org.opengrok.indexer.analysis.AnalyzerGuru;
|
52 | 54 | import org.opengrok.indexer.analysis.AnalyzerGuruHelp;
|
@@ -732,9 +734,13 @@ public static String[] parseOptions(String[] argv) throws ParseException {
|
732 | 734 | parser.on("-U", "--host", "=protocol://host:port/contextPath",
|
733 | 735 | "Send the current configuration to the specified address").Do(webAddr -> {
|
734 | 736 | host = (String) webAddr;
|
735 |
| - String[] schemes = {"http", "https"}; |
736 |
| - UrlValidator urlValidator = new UrlValidator(schemes, UrlValidator.ALLOW_LOCAL_URLS); |
737 |
| - if (!urlValidator.isValid(host)) { |
| 737 | + try { |
| 738 | + URI uri = new URI(host); |
| 739 | + String scheme = uri.getScheme(); |
| 740 | + if (!scheme.equals("http") && !scheme.equals("https")) { |
| 741 | + die("URI '" + host + "' does not have HTTP/HTTPS scheme"); |
| 742 | + } |
| 743 | + } catch (URISyntaxException e) { |
738 | 744 | die("URL '" + host + "' is not valid.");
|
739 | 745 | }
|
740 | 746 |
|
|
0 commit comments