code: private static File getFile(URL resourceUrl) {
      try {
        return new File(new URI(resourceUrl.toString()).getPath());
      } catch (URISyntaxException e) {
        throw new RuntimeException(e);
      } catch (NullPointerException npe) {
        LOG.error("NullPointerException is thrown. Resource url: {} ", resourceUrl);
        throw new RuntimeException(npe);
      }
    }
docs: Workaround for http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4466485
  
  <p>This workaround is not working for file resources in jars. You will get a
  NullPointerException because the URL cannot be converted to URI.