Buggy code:
public class PathMatchingResourcePatternResolver implements ResourcePatternResolver { private static final Log logger = LogFactory . getLog ( PathMatchingResourcePatternResolver . class ) ; private static Method equinoxResolveMethod ; private final ResourceLoader resourceLoader ; private PathMatcher pathMatcher = new AntPathMatcher ( ) ; public PathMatchingResourcePatternResolver ( ) { } public PathMatchingResourcePatternResolver ( ClassLoader classLoader ) { } public PathMatchingResourcePatternResolver ( ResourceLoader resourceLoader ) { } public ResourceLoader getResourceLoader ( ) { } public ClassLoader getClassLoader ( ) { } public void setPathMatcher ( PathMatcher pathMatcher ) { } public PathMatcher getPathMatcher ( ) { } public Resource getResource ( String location ) { } public Resource [ ] getResources ( String locationPattern ) throws IOException { } protected Resource [ ] findAllClassPathResources ( String location ) throws IOException { } protected Resource convertClassLoaderURL ( URL url ) { } protected Resource [ ] findPathMatchingResources ( String locationPattern ) throws IOException { } protected String determineRootDir ( String location ) { } protected Resource resolveRootDirResource ( Resource original ) throws IOException { } protected boolean isJarResource ( Resource resource ) throws IOException { } protected Set < Resource > doFindPathMatchingJarResources ( Resource rootDirResource , String subPattern ) throws IOException { URLConnection con = rootDirResource . getURL ( ) . openConnection ( ) ; JarFile jarFile ; String jarFileUrl ; String rootEntryPath ; boolean newJarFile = false ; if ( con instanceof JarURLConnection ) { JarURLConnection jarCon = ( ( JarURLConnection ) ( con ) ) ; <START_BUG> jarCon . setUseCaches ( jarCon . getClass ( ) . getName ( ) . startsWith ( "JNLP" ) ) ; <END_BUG> jarFile = jarCon . getJarFile ( ) ; jarFileUrl = jarCon . getJarFileURL ( ) . toExternalForm ( ) ; JarEntry jarEntry = jarCon . getJarEntry ( ) ; rootEntryPath = ( jarEntry != null ) ? jarEntry . getName ( ) : "" ; } else { String urlFile = rootDirResource . getURL ( ) . getFile ( ) ; 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 ; } try { if ( PathMatchingResourcePatternResolver . logger . isDebugEnabled ( ) ) { PathMatchingResourcePatternResolver . logger . debug ( ( ( "Looking<seq2seq4repair_space>for<seq2seq4repair_space>matching<seq2seq4repair_space>resources<seq2seq4repair_space>in<seq2seq4repair_space>jar<seq2seq4repair_space>file<seq2seq4repair_space>[" + jarFileUrl ) + "]" ) ) ; } if ( ( ! ( "" . equals ( rootEntryPath ) ) ) && ( ! ( rootEntryPath . endsWith ( "//" ) ) ) ) { rootEntryPath = rootEntryPath + "//" ; } Set < Resource > result = new LinkedHashSet < Resource > ( 8 ) ; for ( Enumeration < JarEntry > entries = jarFile . entries ( ) ; entries . hasMoreElements ( ) ; ) { JarEntry entry = entries . nextElement ( ) ; String entryPath = entry . getName ( ) ; if ( entryPath . startsWith ( rootEntryPath ) ) { String relativePath = entryPath . substring ( rootEntryPath . length ( ) ) ; if ( getPathMatcher ( ) . match ( subPattern , relativePath ) ) { result . add ( rootDirResource . createRelative ( relativePath ) ) ; } } } return result ; } finally { if ( newJarFile ) { jarFile . close ( ) ; } } } protected JarFile getJarFile ( String jarFileUrl ) throws IOException { } protected Set < Resource > doFindPathMatchingFileResources ( Resource rootDirResource , String subPattern ) throws IOException { } protected Set < Resource > doFindMatchingFileSystemResources ( File rootDir , String subPattern ) throws IOException { } protected Set < File > retrieveMatchingFiles ( File rootDir , String pattern ) throws IOException { } protected void doRetrieveMatchingFiles ( String fullPattern , File dir , Set < File > result ) throws IOException { } private static class VfsResourceMatchingDelegate { public static Set < Resource > findMatchingResources ( Resource rootResource , String locationPattern , PathMatcher pathMatcher ) throws IOException { } } private static class PatternVirtualFileVisitor implements InvocationHandler { private final String subPattern ; private final PathMatcher pathMatcher ; private final String rootPath ; private final Set < Resource > resources = new LinkedHashSet < Resource > ( ) ; public PatternVirtualFileVisitor ( String rootPath , String subPattern , PathMatcher pathMatcher ) { } public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Throwable { } public void visit ( Object vfsResource ) { } public Object getAttributes ( ) { } public Set < Resource > getResources ( ) { } @ SuppressWarnings ( "unused" ) public int size ( ) { } public String toString ( ) { } } }

Fix:
ResourceUtils . useCachesIfNecessary ( jarCon ) ;