This is an automated email from the ASF dual-hosted git repository.

nvazquez pushed a commit to branch 4.16
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.16 by this push:
     new 006473ca19 Log exception on keystore build for custom certificate 
(#6394)
006473ca19 is described below

commit 006473ca19358a7d59f117bd64ad9c78d1150560
Author: Nicolas Vazquez <[email protected]>
AuthorDate: Wed May 18 10:29:00 2022 -0300

    Log exception on keystore build for custom certificate (#6394)
    
    * Log exception on keystore build for custom certificate
    
    * Refactor
---
 .../framework/security/keystore/KeystoreManagerImpl.java | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git 
a/framework/security/src/main/java/org/apache/cloudstack/framework/security/keystore/KeystoreManagerImpl.java
 
b/framework/security/src/main/java/org/apache/cloudstack/framework/security/keystore/KeystoreManagerImpl.java
index bed74bf4c3..34755dbd3e 100644
--- 
a/framework/security/src/main/java/org/apache/cloudstack/framework/security/keystore/KeystoreManagerImpl.java
+++ 
b/framework/security/src/main/java/org/apache/cloudstack/framework/security/keystore/KeystoreManagerImpl.java
@@ -108,16 +108,12 @@ public class KeystoreManagerImpl extends ManagerBase 
implements KeystoreManager
 
         try {
             return CertificateHelper.buildAndSaveKeystore(certs, 
storePassword);
-        } catch (KeyStoreException e) {
-            s_logger.warn("Unable to build keystore for " + name + " due to 
KeyStoreException");
-        } catch (CertificateException e) {
-            s_logger.warn("Unable to build keystore for " + name + " due to 
CertificateException");
-        } catch (NoSuchAlgorithmException e) {
-            s_logger.warn("Unable to build keystore for " + name + " due to 
NoSuchAlgorithmException");
-        } catch (InvalidKeySpecException e) {
-            s_logger.warn("Unable to build keystore for " + name + " due to 
InvalidKeySpecException");
-        } catch (IOException e) {
-            s_logger.warn("Unable to build keystore for " + name + " due to 
IOException");
+        } catch (KeyStoreException | CertificateException | 
NoSuchAlgorithmException | InvalidKeySpecException | IOException e) {
+            String msg = String.format("Unable to build keystore for %s due to 
%s", name, e.getClass().getSimpleName());
+            s_logger.warn(msg);
+            if (s_logger.isDebugEnabled()) {
+                s_logger.debug(msg, e);
+            }
         }
         return null;
     }

Reply via email to