Issue #167 : recognize protocols like opc.tcp as valid URI schemes

This commit is contained in:
Sean Owen 2014-06-05 18:26:36 +01:00
parent 9d6878c6a0
commit f4b7264413
2 changed files with 3 additions and 1 deletions

View file

@ -28,7 +28,8 @@ import java.util.regex.Pattern;
*/
public final class URIResultParser extends ResultParser {
private static final Pattern URL_WITH_PROTOCOL_PATTERN = Pattern.compile("[a-zA-Z0-9]{2,}:");
// See http://www.ietf.org/rfc/rfc2396.txt
private static final Pattern URL_WITH_PROTOCOL_PATTERN = Pattern.compile("[a-zA-Z][a-zA-Z0-9+-.]+:");
private static final Pattern URL_WITHOUT_PROTOCOL_PATTERN = Pattern.compile(
"([a-zA-Z0-9\\-]+\\.)+[a-zA-Z]{2,}" + // host name elements
"(:\\d{1,5})?" + // maybe port

View file

@ -104,6 +104,7 @@ public final class URIParsedResultTestCase extends Assert {
"0ZAKOAB32/.8:J501GJJTTWOA+5/6$MIYBERPZ41NJ6-WSG/*Z48ZH*LSAOEM*IXP81L:$F*W08Z60CR*C*P.JEEVI1F02J07L6+" +
"W4L1G$/IC*$16GK6A+:I1-:LJ:Z-P3NW6Z6ADFB-F2AKE$2DWN23GYCYEWX9S8L+LF$VXEKH7/R48E32PU+A:9H:8O5",
null);
doTest("opc.tcp://test.samplehost.com:4841", "opc.tcp://test.samplehost.com:4841", null);
}
private static void doTest(String contents, String uri, String title) {