code: public static URI urlToURI(URL url) {
      try {
        return url.toURI();
      }
      catch (URISyntaxException e) {
        throw LOG.cannotConvertUrlToUri(url, e);
      }
    }
docs: Converts an url to an uri. Escapes whitespaces if needed.
  
  @param url  the url to convert
  @return the resulting uri
  @throws ProcessEngineException if the url has invalid syntax