Here you can find the source of isValid(URI uri)
public static boolean isValid(URI uri)
//package com.java2s; //License from project: Apache License import java.net.URI; public class Main { public static boolean isValid(URI uri) { if (isEmpty(uri.getScheme()) || isEmpty(uri.getHost()) || uri.getPort() == -1) { return false; }/*from www . j a v a2s .c o m*/ return true; } private static boolean isEmpty(String value) { return value == null || value.trim().length() == 0; } }