Skip to content

Commit 006473c

Browse files
authored
Log exception on keystore build for custom certificate (apache#6394)
* Log exception on keystore build for custom certificate * Refactor
1 parent d373f97 commit 006473c

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

framework/security/src/main/java/org/apache/cloudstack/framework/security/keystore/KeystoreManagerImpl.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,12 @@ public byte[] getKeystoreBits(String name, String aliasForCertificateInStore, St
108108

109109
try {
110110
return CertificateHelper.buildAndSaveKeystore(certs, storePassword);
111-
} catch (KeyStoreException e) {
112-
s_logger.warn("Unable to build keystore for " + name + " due to KeyStoreException");
113-
} catch (CertificateException e) {
114-
s_logger.warn("Unable to build keystore for " + name + " due to CertificateException");
115-
} catch (NoSuchAlgorithmException e) {
116-
s_logger.warn("Unable to build keystore for " + name + " due to NoSuchAlgorithmException");
117-
} catch (InvalidKeySpecException e) {
118-
s_logger.warn("Unable to build keystore for " + name + " due to InvalidKeySpecException");
119-
} catch (IOException e) {
120-
s_logger.warn("Unable to build keystore for " + name + " due to IOException");
111+
} catch (KeyStoreException | CertificateException | NoSuchAlgorithmException | InvalidKeySpecException | IOException e) {
112+
String msg = String.format("Unable to build keystore for %s due to %s", name, e.getClass().getSimpleName());
113+
s_logger.warn(msg);
114+
if (s_logger.isDebugEnabled()) {
115+
s_logger.debug(msg, e);
116+
}
121117
}
122118
return null;
123119
}

0 commit comments

Comments
 (0)