Skip to content

Commit edc9a9b

Browse files
committed
Merge branch '1.5.x'
2 parents 7b675fc + 7eb9193 commit edc9a9b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ private static List<URL> getUrlsFromManifestClassPathAttribute(JarFile jarFile)
143143
List<File> nonExistentEntries = new ArrayList<>();
144144
for (String entry : entries) {
145145
try {
146-
File referenced = new File(parent, entry);
146+
File referenced = new File(entry);
147+
if (!referenced.isAbsolute()) {
148+
referenced = new File(parent, entry);
149+
}
147150
if (referenced.exists()) {
148151
urls.add(referenced.toURI().toURL());
149152
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,11 @@ public void skipsUrls() throws Exception {
7575
@Test
7676
public void urlsFromJarClassPathAreConsidered() throws Exception {
7777
File relative = this.temporaryFolder.newFolder();
78+
File absolute = this.temporaryFolder.newFolder();
7879
File jarWithClassPath = makeJarFileWithUrlsInManifestClassPath(
7980
"project-core/target/classes/", "project-web/target/classes/",
80-
"does-not-exist/target/classes", relative.getName() + "/");
81+
"does-not-exist/target/classes", relative.getName() + "/",
82+
absolute.getAbsolutePath() + "/");
8183
new File(jarWithClassPath.getParentFile(), "project-core/target/classes")
8284
.mkdirs();
8385
new File(jarWithClassPath.getParentFile(), "project-web/target/classes").mkdirs();
@@ -87,7 +89,7 @@ public void urlsFromJarClassPathAreConsidered() throws Exception {
8789
assertThat(urls.toList()).containsExactly(
8890
new URL(jarWithClassPath.toURI().toURL(), "project-core/target/classes/"),
8991
new URL(jarWithClassPath.toURI().toURL(), "project-web/target/classes/"),
90-
relative.toURI().toURL());
92+
relative.toURI().toURL(), absolute.toURI().toURL());
9193
}
9294

9395
private URL makeUrl(String name) throws IOException {

0 commit comments

Comments
 (0)