Skip to content

Commit 8662b77

Browse files
committed
PathMatchingResourcePatternResolver converts manifest entries to absolute paths
Issue: SPR-14934
1 parent 96bfc14 commit 8662b77

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,20 +418,22 @@ protected void addAllClassLoaderJarRoots(ClassLoader classLoader, Set<Resource>
418418
protected void addClassPathManifestEntries(Set<Resource> result) {
419419
try {
420420
String javaClassPathProperty = System.getProperty("java.class.path");
421-
for (String url : StringUtils.delimitedListToStringArray(
421+
for (String path : StringUtils.delimitedListToStringArray(
422422
javaClassPathProperty, System.getProperty("path.separator"))) {
423423
try {
424-
if (url.endsWith(ResourceUtils.JAR_FILE_EXTENSION)) {
424+
if (path.endsWith(ResourceUtils.JAR_FILE_EXTENSION)) {
425+
File file = new File(path);
425426
UrlResource jarResource = new UrlResource(ResourceUtils.JAR_URL_PREFIX +
426-
ResourceUtils.FILE_URL_PREFIX + url + ResourceUtils.JAR_URL_SEPARATOR);
427+
ResourceUtils.FILE_URL_PREFIX + file.getAbsolutePath() +
428+
ResourceUtils.JAR_URL_SEPARATOR);
427429
if (jarResource.exists()) {
428430
result.add(jarResource);
429431
}
430432
}
431433
}
432434
catch (MalformedURLException ex) {
433435
if (logger.isDebugEnabled()) {
434-
logger.debug("Cannot search for matching files underneath [" + url +
436+
logger.debug("Cannot search for matching files underneath [" + path +
435437
"] because it cannot be converted to a valid 'jar:' URL: " + ex.getMessage());
436438
}
437439
}

0 commit comments

Comments
 (0)