protected void addAllClassLoaderJarRoots(@Nullable ClassLoader classLoader, Set<Resource> result) {
        if (classLoader instanceof URLClassLoader) {
            try {
                for (URL url : ((URLClassLoader) classLoader).getURLs()) {
                    try {
                        UrlResource jarResource = (ResourceUtils.URL_PROTOCOL_JAR.equals(url.getProtocol()) ?
                            new UrlResource(url) :
                            new UrlResource(ResourceUtils.JAR_URL_PREFIX + url + ResourceUtils.JAR_URL_SEPARATOR));
                        if (jarResource.exists()) {
                            result.add(jarResource);
                        }
                    } catch (MalformedURLException ex) {
                        if (LOGGER.isDebugEnabled()) {
                            LOGGER.debug("Cannot search for matching files underneath [{}] because it cannot be converted to a valid 'jar:' URL: {}", url, ex.getMessage());
                        }
                    }
                }
            } catch (Exception ex) {
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("Cannot introspect jar files since ClassLoader [{}] does not support 'getURLs()': {}", classLoader, ex);
                }
            }
        }

        if (classLoader == ClassLoader.getSystemClassLoader()) {
            // "java.class.path" manifest evaluation...
            addClassPathManifestEntries(result);
        }

        if (classLoader != null) {
            try {
                // Hierarchy traversal...
                addAllClassLoaderJarRoots(classLoader.getParent(), result);
            } catch (Exception ex) {
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("Cannot introspect jar files in parent ClassLoader since [{}] does not support 'getParent()': {}", classLoader, ex);
                }
            }
        }
    }
Search all {link URLClassLoader} URLs for jar file references and add them to the
given set of resources in the form of pointers to the root of the jar file content.

@param classLoader the ClassLoader to search (including its ancestors)
@param result      the set of resources to add jar roots to
@since 4.1.1
analyzer/src/main/java/nl/basjes/parse/useragent/utils/springframework/core/io/support/PathMatchingResourcePatternResolver.java