diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java index 4ee2bca21e..1b7b2d4da3 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java @@ -66,20 +66,16 @@ public abstract class ResourceUtils { * @return a list of URLs */ public static List getUrls(String path, ClassLoader classLoader) { - if (classLoader == null) { classLoader = ClassUtils.getDefaultClassLoader(); } - path = StringUtils.cleanPath(path); - try { return getUrlsFromWildcardPath(path, classLoader); } catch (Exception ex) { throw new IllegalArgumentException( "Cannot create URL from path [" + path + "]", ex); - } } @@ -88,7 +84,6 @@ public abstract class ResourceUtils { if (path.contains(":")) { return getUrlsFromPrefixedWildcardPath(path, classLoader); } - Set result = new LinkedHashSet(); try { result.addAll(getUrls(FILE_URL_PREFIX + path, classLoader)); @@ -96,7 +91,6 @@ public abstract class ResourceUtils { catch (IllegalArgumentException ex) { // ignore } - path = stripLeadingSlashes(path); result.addAll(getUrls(ALL_CLASSPATH_URL_PREFIX + path, classLoader)); return new ArrayList(result); diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java index 645b269ca8..9f5c97fb57 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java @@ -77,11 +77,17 @@ public class ClassPathFileSystemWatcherTests { context.getEnvironment().getPropertySources().addLast(propertySource); context.register(Config.class); context.refresh(); - Thread.sleep(100); + Thread.sleep(200); File classFile = new File(folder, "Example.class"); FileCopyUtils.copy("file".getBytes(), classFile); - Thread.sleep(1100); + Thread.sleep(1000); List events = context.getBean(Listener.class).getEvents(); + for (int i = 0; i < 20; i++) { + if (!events.isEmpty()) { + break; + } + Thread.sleep(500); + } assertThat(events.size()).isEqualTo(1); assertThat(events.get(0).getChangeSet().iterator().next().getFiles().iterator() .next().getFile()).isEqualTo(classFile);