docs: private static Collection<? extends URL> doFindPathMatchingJarResources(final URL rootDirResource, final String subPattern) {
  
          final Set<URL> result = new LinkedHashSet<URL>();
  
          JarFile jarFile = null;
          String jarFileUrl;
          String rootEntryPath = null;
          URLConnection con;
          boolean newJarFile = false;
  
          try {
              con = rootDirResource.openConnection();
  
              if (con instanceof JarURLConnection) {
                  final JarURLConnection jarCon = (JarURLConnection) con;
  
                  jarCon.setUseCaches(false);
                  jarFile = jarCon.getJarFile();
                  jarFileUrl = jarCon.getJarFileURL().toExternalForm();
                  final JarEntry jarEntry = jarCon.getJarEntry();
  
                  rootEntryPath = jarEntry != null ? jarEntry.getName() : "";
              } else {
                  // No JarURLConnection -> need to resort to URL file parsing.
                  // We'll assume URLs of the format "jar:path!/entry", with the
                  // protocol
                  // being arbitrary as long as following the entry format.
                  // We'll also handle paths with and without leading "file:"
                  // prefix.
                  final String urlFile = rootDirResource.getFile();
                  final int separatorIndex = urlFile.indexOf(JAR_URL_SEPARATOR);
  
                  if (separatorIndex != -1) {
                      jarFileUrl = urlFile.substring(0, separatorIndex);
                      rootEntryPath = urlFile.substring(separatorIndex + JAR_URL_SEPARATOR.length());
                      jarFile = getJarFile(jarFileUrl);
                  } else {
                      jarFile = new JarFile(urlFile);
                      jarFileUrl = urlFile;
                      rootEntryPath = "";
                  }
                  newJarFile = true;
  
              }
  
          } catch (final IOException e) {
              LOGGER.log(Level.ERROR, "reslove jar File error", e);
              return result;
          }
          try {
              if (!"".equals(rootEntryPath) && !rootEntryPath.endsWith("/")) {
                  // Root entry path must end with slash to allow for proper
                  // matching.
                  // The Sun JRE does not return a slash here, but BEA JRockit
                  // does.
                  rootEntryPath = rootEntryPath + "/";
              }
              for (final Enumeration<JarEntry> entries = jarFile.entries(); entries.hasMoreElements(); ) {
                  final JarEntry entry = (JarEntry) entries.nextElement();
                  final String entryPath = entry.getName();
  
                  String relativePath = null;
  
                  if (entryPath.startsWith(rootEntryPath)) {
                      relativePath = entryPath.substring(rootEntryPath.length());
  
                      if (AntPathMatcher.match(subPattern, relativePath)) {
                          if (relativePath.startsWith("/")) {
                              relativePath = relativePath.substring(1);
                          }
                          result.add(new URL(rootDirResource, relativePath));
                      }
                  }
              }
              return result;
          } catch (final IOException e) {
              LOGGER.log(Level.ERROR, "parse the JarFile error", e);
          } finally {
              // Close jar file, but only if freshly obtained -
              // not from JarURLConnection, which might cache the file reference.
              if (newJarFile) {
                  try {
                      jarFile.close();
                  } catch (final IOException e) {
                      LOGGER.log(Level.WARN, " occur error when closing jarFile", e);
                  }
              }
          }
          return result;
      }