mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Attempt to fix Windows build failure due to open files
See gh-38204
This commit is contained in:
+8
-2
@@ -502,8 +502,14 @@ class JarUrlConnectionTests {
|
|||||||
void getLastModifiedHeaderReturnsFileModifiedTime() throws IOException {
|
void getLastModifiedHeaderReturnsFileModifiedTime() throws IOException {
|
||||||
JarUrlConnection connection = JarUrlConnection.open(this.url);
|
JarUrlConnection connection = JarUrlConnection.open(this.url);
|
||||||
URLConnection fileConnection = this.file.toURI().toURL().openConnection();
|
URLConnection fileConnection = this.file.toURI().toURL().openConnection();
|
||||||
assertThat(connection.getHeaderFieldDate("last-modified", 0)).isEqualTo(withoutNanos(this.file.lastModified()))
|
try {
|
||||||
.isEqualTo(fileConnection.getHeaderFieldDate("last-modified", 0));
|
assertThat(connection.getHeaderFieldDate("last-modified", 0))
|
||||||
|
.isEqualTo(withoutNanos(this.file.lastModified()))
|
||||||
|
.isEqualTo(fileConnection.getHeaderFieldDate("last-modified", 0));
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
fileConnection.getInputStream().close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private long withoutNanos(long epochMilli) {
|
private long withoutNanos(long epochMilli) {
|
||||||
|
|||||||
+8
-3
@@ -162,9 +162,14 @@ class NestedUrlConnectionTests {
|
|||||||
void getLastModifiedHeaderReturnsFileModifiedTime() throws IOException {
|
void getLastModifiedHeaderReturnsFileModifiedTime() throws IOException {
|
||||||
NestedUrlConnection connection = new NestedUrlConnection(this.url);
|
NestedUrlConnection connection = new NestedUrlConnection(this.url);
|
||||||
URLConnection fileConnection = this.jarFile.toURI().toURL().openConnection();
|
URLConnection fileConnection = this.jarFile.toURI().toURL().openConnection();
|
||||||
assertThat(connection.getHeaderFieldDate("last-modified", 0))
|
try {
|
||||||
.isEqualTo(withoutNanos(this.jarFile.lastModified()))
|
assertThat(connection.getHeaderFieldDate("last-modified", 0))
|
||||||
.isEqualTo(fileConnection.getHeaderFieldDate("last-modified", 0));
|
.isEqualTo(withoutNanos(this.jarFile.lastModified()))
|
||||||
|
.isEqualTo(fileConnection.getHeaderFieldDate("last-modified", 0));
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
fileConnection.getInputStream().close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private long withoutNanos(long epochMilli) {
|
private long withoutNanos(long epochMilli) {
|
||||||
|
|||||||
Reference in New Issue
Block a user