code: public static URI uriFromUrl(URL url) throws IllegalArgumentException {
          try {
              return url.toURI();
          } catch (URISyntaxException e) {
              throw new IllegalArgumentException(e);
          }
      }
docs: Create a {@link URI} from a {@link URL}. This is similar to calling
  `url.toURI()` with the {@link URISyntaxException}
  converted to a {@link IllegalArgumentException}.
  
  @param url the url
  @return the uri
  @throws IllegalArgumentException if the url violates RFC 2396