Skip to content

Commit 078536a

Browse files
committed
Merge branch '2.1.x'
Closes spring-projectsgh-18502
2 parents bc8a88d + f42b442 commit 078536a

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ChangeableUrls.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.net.MalformedURLException;
2323
import java.net.URL;
2424
import java.net.URLClassLoader;
25+
import java.net.URLDecoder;
2526
import java.util.ArrayList;
2627
import java.util.Collection;
2728
import java.util.Collections;
@@ -156,7 +157,13 @@ private static List<URL> getUrlsFromManifestClassPathAttribute(URL jarUrl, JarFi
156157
urls.add(referenced);
157158
}
158159
else {
159-
nonExistentEntries.add(referenced);
160+
referenced = new URL(jarUrl, URLDecoder.decode(entry, "UTF-8"));
161+
if (new File(referenced.getFile()).exists()) {
162+
urls.add(referenced);
163+
}
164+
else {
165+
nonExistentEntries.add(referenced);
166+
}
160167
}
161168
}
162169
catch (MalformedURLException ex) {

spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/ChangeableUrlsTests.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,17 @@ void urlsFromJarClassPathAreConsidered() throws Exception {
8787
absolute.mkdirs();
8888
URL absoluteUrl = absolute.toURI().toURL();
8989
File jarWithClassPath = makeJarFileWithUrlsInManifestClassPath("project-core/target/classes/",
90-
"project-web/target/classes/", "does-not-exist/target/classes", relative.getName() + "/", absoluteUrl);
90+
"project-web/target/classes/", "project%20space/target/classes/", "does-not-exist/target/classes/",
91+
relative.getName() + "/", absoluteUrl);
9192
new File(jarWithClassPath.getParentFile(), "project-core/target/classes").mkdirs();
9293
new File(jarWithClassPath.getParentFile(), "project-web/target/classes").mkdirs();
94+
new File(jarWithClassPath.getParentFile(), "project space/target/classes").mkdirs();
9395
ChangeableUrls urls = ChangeableUrls.fromClassLoader(
9496
new URLClassLoader(new URL[] { jarWithClassPath.toURI().toURL(), makeJarFileWithNoManifest() }));
9597
assertThat(urls.toList()).containsExactly(
9698
new URL(jarWithClassPath.toURI().toURL(), "project-core/target/classes/"),
97-
new URL(jarWithClassPath.toURI().toURL(), "project-web/target/classes/"), relative.toURI().toURL(),
99+
new URL(jarWithClassPath.toURI().toURL(), "project-web/target/classes/"),
100+
new URL(jarWithClassPath.toURI().toURL(), "project space/target/classes/"), relative.toURI().toURL(),
98101
absoluteUrl);
99102
}
100103

0 commit comments

Comments
 (0)