code: private static URI toUri(final URL u) {
  
          try {
              return u.toURI();
          } catch (URISyntaxException e) {
              throw new IllegalArgumentException("Could not convert URL "+u+" to uri",e);
          }
      }
docs: Converts a url to uri without throwing a checked exception. In case an URI syntax exception occurs, an
  IllegalArgumentException is thrown.
  @param u
  the url to be converted
  @return
  the converted uri