8365700: Jar --validate without any --file option leaves around a temporary file /tmp/tmpJar<number>.jar

Reviewed-by: jpai, asteiner
This commit is contained in:
Matthias Baesken 2025-08-20 06:47:36 +00:00
parent b453eb63c6
commit 320235ccb8

View File

@ -420,7 +420,8 @@ public class Main {
if (fname != null) {
file = new File(fname);
} else {
file = createTemporaryFile("tmpJar", ".jar");
tmpFile = createTemporaryFile("tmpJar", ".jar");
file = tmpFile;
try (InputStream in = new FileInputStream(FileDescriptor.in);
OutputStream os = Files.newOutputStream(file.toPath())) {
in.transferTo(os);