Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Error messages thrown from the JDBC KeyStore Persistence Manager #4164

Open
wants to merge 1 commit into
base: 4.10.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -105,7 +105,7 @@ public Optional<KeyStoreModel> 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);
}
Expand All @@ -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);
}
}

Expand All @@ -137,7 +138,7 @@ public List<KeyStoreModel> 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;
}
Expand All @@ -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);
}
}

Expand All @@ -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);
}

}
Expand All @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}

Expand Down