Refine PropertiesLauncher close logic

Further attempt to fix Windows file issues.

See gh-21575
This commit is contained in:
Phillip Webb
2020-06-11 13:25:56 -07:00
parent 1e7da4d3ca
commit 2a37b2e258
2 changed files with 8 additions and 9 deletions

View File

@@ -389,6 +389,10 @@ class PropertiesLauncherTests {
this.launcher.launch(new String[0]);
}
catch (Exception ex) {
// Expected ClassNotFoundException
LaunchedURLClassLoader classLoader = (LaunchedURLClassLoader) Thread.currentThread()
.getContextClassLoader();
classLoader.close();
}
URL resource = new URL("jar:" + jarFile.toURI() + "!/nested.jar!/3.dat");
byte[] bytes = FileCopyUtils.copyToByteArray(resource.openStream());