Delete unpacked jars when the JVM exits

Update `JarFileArchive` so that any unpacked files are now deleted when
the JVM exits.

Closes gh-25773
This commit is contained in:
Phillip Webb 2021-03-23 17:04:42 -07:00
parent 05f61bccea
commit ec21202d54
1 changed files with 1 additions and 0 deletions

View File

@ -158,6 +158,7 @@ public class JarFileArchive implements Archive {
private void unpack(JarEntry entry, Path path) throws IOException {
createFile(path);
path.toFile().deleteOnExit();
try (InputStream inputStream = this.jarFile.getInputStream(entry);
OutputStream outputStream = Files.newOutputStream(path, StandardOpenOption.WRITE,
StandardOpenOption.TRUNCATE_EXISTING)) {