class UriValidator implements ValueListValidator {

    @Override
    public void validate(List<String> values) throws XDSMetaDataException {
        if (values.size() > 0) {
            String uri = getUri(values);
            metaDataAssert(uri != null, NULL_URI);
            metaDataAssert(!uri.isEmpty(), EMPTY_URI);
            
            // Accept anything that the classes URI or URL accept. This is done to
            // avoid e.g. "http://" to fail. The XDSToolKit is using this URI
            // for some tests and the RFCs do not clearly state if this is a valid
            // URI or not. The URL class seems to accept it, the URI class doesn't.
            try {
                new URI(uri);
            }
            catch (URISyntaxException eUri) {
                try {
                    new URL(uri);
                } catch (MalformedURLException eUrl) {
                    throw new XDSMetaDataException(INVALID_URI, uri);
                }
            }
        }
    }

}