Remove redundant format calls in log calls `log` supports formatted strings out of the box. Change-Id: I9bb49d689c08194b2d9b34b158fa3b77282fa7f9
diff --git a/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/BatchRefUpdateValidator.java b/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/BatchRefUpdateValidator.java index 2c909f6..02ae01c 100644 --- a/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/BatchRefUpdateValidator.java +++ b/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/BatchRefUpdateValidator.java
@@ -162,17 +162,15 @@ } catch (Exception e) { List<ReceiveCommand> receiveCommands = batchRefUpdate.getCommands(); logger.atWarning().withCause(e).log( - String.format( - "Batch ref-update failing because of failure during the global refdb update. Set all commands Result to LOCK_FAILURE [%d]", - receiveCommands.size())); + "Batch ref-update failing because of failure during the global refdb update. Set all commands Result to LOCK_FAILURE [%d]", + receiveCommands.size()); rollback(delegateUpdateRollback, finalRefsToUpdate, receiveCommands); } } catch (OutOfSyncException e) { List<ReceiveCommand> receiveCommands = batchRefUpdate.getCommands(); logger.atWarning().withCause(e).log( - String.format( - "Batch ref-update failing because node is out of sync with the shared ref-db. Set all commands Result to LOCK_FAILURE [%d]", - receiveCommands.size())); + "Batch ref-update failing because node is out of sync with the shared ref-db. Set all commands Result to LOCK_FAILURE [%d]", + receiveCommands.size()); receiveCommands.forEach((command) -> command.setResult(ReceiveCommand.Result.LOCK_FAILURE)); } }
diff --git a/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java b/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java index a8047e6..0168f2f 100644 --- a/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java +++ b/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java
@@ -167,9 +167,8 @@ private <T extends Throwable> void softFailBasedOnEnforcement(T e, EnforcePolicy policy) throws T { logger.atWarning().withCause(e).log( - String.format( - "Failure while running with policy enforcement %s. Error message: %s", - policy, e.getMessage())); + "Failure while running with policy enforcement %s. Error message: %s", + policy, e.getMessage()); if (policy == EnforcePolicy.REQUIRED) { throw e; } @@ -201,14 +200,13 @@ result = RefUpdate.Result.LOCK_FAILURE; } logger.atSevere().withCause(e).log( - String.format( - "Failed to update global refdb, the local refdb has been rolled back: %s", - e.getMessage())); + "Failed to update global refdb, the local refdb has been rolled back: %s", + e.getMessage()); } return result; } catch (OutOfSyncException e) { logger.atWarning().withCause(e).log( - String.format("Local node is out of sync with ref-db: %s", e.getMessage())); + "Local node is out of sync with ref-db: %s", e.getMessage()); return RefUpdate.Result.LOCK_FAILURE; }