public static String formatURL(String url){
  if (!Strings.isNullOrEmpty(url)) {
    try {
      URI uri=URI.create(url);
      if (uri.isAbsolute()) {
        return url;
      }
 else {
        return "http://" + url;
      }
    }
 catch (    IllegalArgumentException e) {
      return null;
    }
  }
 else {
    return null;
  }
}

public static String formatURL ( String url ) { if ( ! Strings . isNullOrEmpty ( url ) ) { try { URI uri = URI . create ( url ) ; if ( uri . isAbsolute ( ) ) { return url ; } else { return "http://" + url ; } } catch ( IllegalArgumentException e ) { return null ; } } else { return null ; } }
returns a formatted url string , prefixing it with a default scheme component if its not an absolute url .
