Merge branch '1.3.x'

This commit is contained in:
Andy Wilkinson
2016-08-18 13:30:56 +01:00
2 changed files with 32 additions and 25 deletions

View File

@@ -32,6 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Dave Syer
* @author Phillip Webb
* @author Andy Wilkinson
*/
@SuppressWarnings("resource")
public class LaunchedURLClassLoaderTests {
@@ -85,4 +86,23 @@ public class LaunchedURLClassLoaderTests {
assertThat(resource.openConnection().getInputStream().read()).isEqualTo(3);
}
@Test
public void resolveFromNestedWhileThreadIsInterrupted() throws Exception {
File file = this.temporaryFolder.newFile();
TestJarCreator.createTestJar(file);
JarFile jarFile = new JarFile(file);
URL url = jarFile.getUrl();
LaunchedURLClassLoader loader = new LaunchedURLClassLoader(new URL[] { url },
null);
try {
Thread.currentThread().interrupt();
URL resource = loader.getResource("nested.jar!/3.dat");
assertThat(resource.toString(), equalTo(url + "nested.jar!/3.dat"));
assertThat(resource.openConnection().getInputStream().read(), equalTo(3));
}
finally {
Thread.interrupted();
}
}
}