Merge branch '2.4.x'

Closes gh-26451
This commit is contained in:
Andy Wilkinson
2021-05-13 11:44:27 +01:00
2 changed files with 8 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -172,13 +172,9 @@ class HandlerTests {
TestJarCreator.createTestJar(testJar);
URL url = new URL(null, "jar:" + testJar.toURI().toURL() + "!/nested.jar!/3.dat", this.handler);
JarURLConnection connection = (JarURLConnection) url.openConnection();
JarFile jarFile = JarFileWrapper.unwrap(connection.getJarFile());
try {
try (JarFile jarFile = JarFileWrapper.unwrap(connection.getJarFile())) {
assertThat(jarFile.getRootJarFile().getFile()).isEqualTo(testJar);
}
finally {
jarFile.close();
}
}
@Test
@@ -187,13 +183,9 @@ class HandlerTests {
TestJarCreator.createTestJar(testJar);
URL url = new URL(null, "jar:" + testJar.toURI().toURL() + "!/nested.jar!/3.dat", this.handler);
JarURLConnection connection = (JarURLConnection) url.openConnection();
JarFile jarFile = JarFileWrapper.unwrap(connection.getJarFile());
try {
try (JarFile jarFile = JarFileWrapper.unwrap(connection.getJarFile())) {
assertThat(jarFile.getRootJarFile().getFile()).isEqualTo(testJar);
}
finally {
jarFile.close();
}
}
private void assertStandardAndCustomHandlerUrlsAreEqual(String context, String spec) throws MalformedURLException {