Consistent alphabetical sorting of directory content

Issue: SPR-14085
master
Juergen Hoeller 9 years ago
parent 1ec35e9c62
commit 55f1c98c39
  1. 2
      spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java

@ -26,6 +26,7 @@ import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.net.URLConnection; import java.net.URLConnection;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
@ -750,6 +751,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
} }
return; return;
} }
Arrays.sort(dirContents);
for (File content : dirContents) { for (File content : dirContents) {
String currPath = StringUtils.replace(content.getAbsolutePath(), File.separator, "/"); String currPath = StringUtils.replace(content.getAbsolutePath(), File.separator, "/");
if (content.isDirectory() && getPathMatcher().matchStart(fullPattern, currPath + "/")) { if (content.isDirectory() && getPathMatcher().matchStart(fullPattern, currPath + "/")) {

Loading…
Cancel
Save