code: public static URL getUrl(final String name) throws MalformedURLException {
          final File file = new File(name);
          if (file.exists()) {
              return getUrl(file);
          }
  
          final URL resourceUrl =
                  Thread.currentThread().getContextClassLoader().getResource(name);
          if (resourceUrl != null) {
              return resourceUrl;
          }
  
          return new URL(name);
      }
docs: Attempts to return a URL for a file or resource. First, it is
  checked whether {@code name} refers to an existing local file.
  If not, the context class loader of the current thread is asked
  if {@code name} refers to a resource. Finally, the method
  attempts to interpret {@code name} as a URL.
  
  @param name reference to a file or resource maybe a URL
  @return a URL referring to a file or resource
  @throws MalformedURLException if the name is a failed URL