Skip to content

Commit 88bf3df

Browse files
committed
Close byte channel created by newByteChannelReturnsByteChannel
See gh-7161
1 parent dad5dc6 commit 88bf3df

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/nio/file/NestedFileSystemProviderTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ void getPathWhenFileSystemDoesNtExistReturnsPath() throws Exception {
137137
void newByteChannelReturnsByteChannel() throws Exception {
138138
URI uri = new URI(this.uriPrefix + "nested.jar");
139139
Path path = this.provider.getPath(uri);
140-
SeekableByteChannel byteChannel = this.provider.newByteChannel(path, Set.of(StandardOpenOption.READ));
141-
assertThat(byteChannel).isInstanceOf(NestedByteChannel.class);
140+
try (SeekableByteChannel byteChannel = this.provider.newByteChannel(path, Set.of(StandardOpenOption.READ))) {
141+
assertThat(byteChannel).isInstanceOf(NestedByteChannel.class);
142+
}
142143
}
143144

144145
@Test

0 commit comments

Comments
 (0)