code: @SuppressWarnings("PMD.EmptyCatchBlock")
      public static ResourceInfo resourceInfo(URL resource) {
          try {
              Path path = Paths.get(resource.toURI());
              return new ResourceInfo(Files.isDirectory(path),
                  Files.getLastModifiedTime(path).toInstant()
                      .with(ChronoField.NANO_OF_SECOND, 0));
          } catch (FileSystemNotFoundException | IOException
                  | URISyntaxException e) {
              // Fall through
          }
          if ("jar".equals(resource.getProtocol())) {
              try {
                  JarURLConnection conn
                      = (JarURLConnection) resource.openConnection();
                  JarEntry entry = conn.getJarEntry();
                  return new ResourceInfo(entry.isDirectory(),
                      entry.getLastModifiedTime().toInstant()
                          .with(ChronoField.NANO_OF_SECOND, 0));
              } catch (IOException e) {
                  // Fall through
              }
          }
          try {
              URLConnection conn = resource.openConnection();
              long lastModified = conn.getLastModified();
              if (lastModified != 0) {
                  return new ResourceInfo(null, Instant.ofEpochMilli(
                      lastModified).with(ChronoField.NANO_OF_SECOND, 0));
              }
          } catch (IOException e) {
              // Fall through
          }
          return new ResourceInfo(null, null);
      }
docs: Attempts to lookup the additional resource information for the
  given URL.
  
  If a {@link URL} references a file, it is easy to find out if
  the resource referenced is a directory and to get its last
  modification time. Getting the same information
  for a {@link URL} that references resources in a jar is a bit
  more difficult. This method handles both cases.
  
  @param resource the resource URL
  @return the resource info