Use AutoClosables with try-with-resources
Closes gh-33538
This commit is contained in:
@@ -294,9 +294,10 @@ class JarFileTests {
|
||||
void getEntryUrlStream() throws Exception {
|
||||
URL url = new URL(this.jarFile.getUrl(), "1.dat");
|
||||
url.openConnection();
|
||||
InputStream stream = url.openStream();
|
||||
assertThat(stream.read()).isEqualTo(1);
|
||||
assertThat(stream.read()).isEqualTo(-1);
|
||||
try (InputStream stream = url.openStream()) {
|
||||
assertThat(stream.read()).isEqualTo(1);
|
||||
assertThat(stream.read()).isEqualTo(-1);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user