Github user neykov commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/196#discussion_r67030921 --- Diff: core/src/main/java/org/apache/brooklyn/util/core/crypto/SecureKeys.java --- @@ -78,11 +78,11 @@ public static X509Principal getX509PrincipalWithCommonName(String commonName) { return new X509Principal("" + "C=None," + "L=None," + "O=None," + "OU=None," + "CN=" + commonName); } - /** reads RSA or DSA / pem style private key files (viz {@link #toPem(KeyPair)}), extracting also the public key if possible + /** reads RSA or DSA / pem style private key files (viz {@link #toPem(KeyPair)}), extracting also the public key if possible. Closes the stream. * @throws IllegalStateException on errors, in particular {@link PassphraseProblem} if that is the problem */ public static KeyPair readPem(InputStream input, final String passphrase) { // TODO cache is only for fallback "reader" strategy (2015-01); delete when Parser confirmed working - byte[] cache = Streams.readFully(input); + byte[] cache = Streams.readFullyAndClose(input); --- End diff -- Agree in general. It's the way we use readPem that prompted me to do the change - we are not closing the streams in any of the callers. Will have another look on how it can be improved.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---