Skip to content

Instantly share code, notes, and snippets.

@michaelklishin
Created November 4, 2013 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelklishin/71eaeb702a7af4a20c41 to your computer and use it in GitHub Desktop.
Save michaelklishin/71eaeb702a7af4a20c41 to your computer and use it in GitHub Desktop.
protected static int validateURI(String srvURI) {
try {
URI vURI = new URI(srvURI);
if (!vURI.getPath().equals("")) {
throw new IllegalArgumentException(srvURI);
}
if (vURI.getScheme().equals("tcp")) {
return URI_TYPE_TCP;
}
else if (vURI.getScheme().equals("ssl")) {
return URI_TYPE_SSL;
}
else if (vURI.getScheme().equals("local")) {
return URI_TYPE_LOCAL;
}
else {
throw new IllegalArgumentException(srvURI);
}
} catch (URISyntaxException ex) {
throw new IllegalArgumentException(srvURI);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment