Skip to content

Commit 851e6de

Browse files
committed
Fix tests on Windows
See gh-37808
1 parent 1559485 commit 851e6de

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ssl/SslPropertiesBundleRegistrar.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package org.springframework.boot.autoconfigure.ssl;
1818

19-
import java.io.FileNotFoundException;
20-
import java.io.UncheckedIOException;
2119
import java.net.URL;
2220
import java.nio.file.Path;
2321
import java.util.LinkedHashSet;
@@ -106,10 +104,10 @@ private Path toPath(String bundleName, Location watchableLocation) {
106104
URL url = ResourceUtils.getURL(value);
107105
Assert.state("file".equalsIgnoreCase(url.getProtocol()),
108106
() -> "SSL bundle '%s' '%s' URL '%s' doesn't point to a file".formatted(bundleName, field, url));
109-
return Path.of(url.getFile()).toAbsolutePath();
107+
return Path.of(url.toURI()).toAbsolutePath();
110108
}
111-
catch (FileNotFoundException ex) {
112-
throw new UncheckedIOException(
109+
catch (Exception ex) {
110+
throw new RuntimeException(
113111
"SSL bundle '%s' '%s' location '%s' cannot be watched".formatted(bundleName, field, value), ex);
114112
}
115113
}

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ssl/FileWatcherTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void shouldFailIfDirectoryOrFileDoesNotExist(@TempDir Path tempDir) {
111111
Path directory = tempDir.resolve("dir1");
112112
assertThatExceptionOfType(UncheckedIOException.class)
113113
.isThrownBy(() -> this.fileWatcher.watch(Set.of(directory), new WaitingCallback()))
114-
.withMessageMatching("Failed to register paths for watching: \\[.+/dir1]");
114+
.withMessage("Failed to register paths for watching: [%s]".formatted(directory));
115115
}
116116

117117
@Test

0 commit comments

Comments
 (0)