code: public static URI urlToUri( String urlAsString ) throws URISyntaxException {
  
  		URL url;
  		try {
  			url = new URL( urlAsString );
  
  		} catch( Exception e ) {
  			throw new URISyntaxException( urlAsString, "Invalid URL." );
  		}
  
  		return urlToUri( url );
  	}
docs: Builds an URI from an URL string (with an handle for URLs not compliant with RFC 2396).
  @param urlAsString an URL as a string
  @return an URI
  @throws URISyntaxException if the URI is invalid and could not be repaired