diff --git a/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/keystore/persistence/impl/JDBCKeyStorePersistenceManager.java b/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/keystore/persistence/impl/JDBCKeyStorePersistenceManager.java index fe0b435966..511441d3c3 100644 --- a/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/keystore/persistence/impl/JDBCKeyStorePersistenceManager.java +++ b/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/keystore/persistence/impl/JDBCKeyStorePersistenceManager.java @@ -89,7 +89,7 @@ public void addKeystore(KeyStoreModel keyStore, int tenantId) throws SecurityExc preparedStatement.setTimeStamp(UPDATED_AT, currentTime, CALENDAR); }), keyStore, false); } catch (DataAccessException e) { - throw new SecurityException("Error while adding the key store.", e); + throw new SecurityException("Error while adding the key store: " + keyStore.getName(), e); } } @@ -105,7 +105,7 @@ public Optional getKeyStore(String keyStoreName, int tenantId) th preparedStatement.setInt(TENANT_ID, tenantId); })); } catch (DataAccessException e) { - throw new SecurityException("Error while retrieving key store.", e); + throw new SecurityException("Error while retrieving key store: " + keyStoreName, e); } return Optional.ofNullable(keyStoreModel); } @@ -122,7 +122,8 @@ public boolean isKeyStoreExists(String keyStoreName, int tenantId) throws Securi })); return keystoreID != null; } catch (DataAccessException e) { - throw new SecurityException("Error while checking Tenant Primary KeyStore existence", e); + throw new SecurityException("Error while checking the KeyStore existence for keystore name: " + + keyStoreName, e); } } @@ -137,7 +138,7 @@ public List listKeyStores(int tenantId) throws SecurityException preparedStatement.setInt(TENANT_ID, tenantId) )); } catch (DataAccessException e) { - throw new SecurityException("Error while retrieving key store list of tenant.", e); + throw new SecurityException("Error while retrieving key store list of tenant: " + tenantId, e); } return keyStores; } @@ -155,7 +156,7 @@ public void updateKeyStore(KeyStoreModel keyStoreModel, int tenantId) throws Sec preparedStatement.setInt(TENANT_ID, tenantId); })); } catch (DataAccessException e) { - throw new SecurityException("Error while updating key store.", e); + throw new SecurityException("Error while updating key store: " + keyStoreModel.getName(), e); } } @@ -169,7 +170,7 @@ public void deleteKeyStore(String keyStoreName, int tenantId) throws SecurityExc preparedStatement.setInt(TENANT_ID, tenantId); })); } catch (DataAccessException e) { - throw new SecurityException("Error while deleting key store.", e); + throw new SecurityException("Error while deleting key store: " + keyStoreName, e); } } @@ -185,7 +186,8 @@ public Date getKeyStoreLastModifiedDate(String keyStoreName, int tenantId) { preparedStatement.setInt(TENANT_ID, tenantId); })); } catch (DataAccessException e) { - throw new SecurityException("Error while retrieving key store last modified date.", e); + throw new SecurityException("Error while retrieving key store last modified date for keystore: " + + keyStoreName, e); } } @@ -215,7 +217,7 @@ public String getEncryptedPrivateKeyPassword(String keyStoreName, int tenantId) preparedStatement.setInt(TENANT_ID, tenantId); })); } catch (DataAccessException e) { - throw new SecurityException("Error while retrieving private key password.", e); + throw new SecurityException("Error while retrieving private key password :" + keyStoreName, e); } }