DaanHoogland commented on code in PR #6812:
URL: https://github.com/apache/cloudstack/pull/6812#discussion_r1007852306
##########
engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41710to41800.java:
##########
@@ -128,16 +129,17 @@ protected void updateConfigValuesWithScope(Connection
conn, Map<Long, String> co
String updateConfigValues = String.format("UPDATE cloud.%s SET value =
? WHERE id = ?;", table);
for (Map.Entry<Long, String> config : configsToBeUpdated.entrySet()) {
- String decryptedValue =
DBEncryptionUtil.decrypt(config.getValue());
-
try (PreparedStatement pstmt =
conn.prepareStatement(updateConfigValues)) {
+ String decryptedValue =
DBEncryptionUtil.decrypt(config.getValue());
+
pstmt.setString(1, decryptedValue);
pstmt.setLong(2, config.getKey());
LOG.info(String.format("Updating config with ID [%s] to value
[%s].", config.getKey(), decryptedValue));
pstmt.executeUpdate();
- } catch (SQLException e) {
- String message = String.format("Unable to update config value
with ID [%s] on table [%s] due to [%s].", config.getKey(), table,
e.getMessage());
+ } catch (SQLException | EncryptionOperationNotPossibleException e)
{
+ String message = String.format("Unable to update config value
with ID [%s] on table [%s] due to [%s]. The config value may already be
decrypted.",
+ config.getKey(), table, e);
LOG.error(message, e);
Review Comment:
let's change this to
```suggestion
LOG.error(message);
if (LOG.isDebugEnabled()) {
LOG.debug(message, e);
}
```
the cause is already mentioned in the message and we wouldn´t want
stacktraces if debug is not required.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]