8026301: DomainKeyStore doesn't cleanup correctly when storing to keystore
Reviewed-by: mullan
--- a/jdk/src/share/classes/sun/security/provider/DomainKeyStore.java Fri Oct 11 09:17:18 2013 -0400
+++ b/jdk/src/share/classes/sun/security/provider/DomainKeyStore.java Fri Oct 11 20:35:00 2013 +0100
@@ -652,9 +652,12 @@
// Store the keystores
KeyStore keystore = keystores.get(builder.name);
- keystore.store(new FileOutputStream(builder.file),
- password);
+ try (FileOutputStream stream =
+ new FileOutputStream(builder.file)) {
+
+ keystore.store(stream, password);
+ }
} catch (KeyStoreException e) {
throw new IOException(e);
}