Fix Flogger formatting errors raised by errorprone Change-Id: I30f143fceb905cd6531e5f0bee8b041922dc9a04
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 0fe5ad5..22aae61 100644 --- a/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/BatchRefUpdateValidator.java +++ b/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/BatchRefUpdateValidator.java
@@ -150,7 +150,7 @@ .collect(Collectors.joining(", ")); Exception firstFailureException = refsFailures.get(0).exception; - logger.atSevere().withCause(firstFailureException).log(allFailuresMessage); + logger.atSevere().withCause(firstFailureException).log("%s", allFailuresMessage); throw new IOException(allFailuresMessage, firstFailureException); } @@ -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 e2a0bd3..3086c26 100644 --- a/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java +++ b/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java
@@ -159,16 +159,15 @@ private Boolean isRefToBeIgnored(String refName) { Boolean isRefToBeIgnored = ignoredRefs.contains(refName); - logger.atFine().log("Is project version update? " + isRefToBeIgnored); + logger.atFine().log("Is project version update? %s", isRefToBeIgnored); return isRefToBeIgnored; } 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; } @@ -176,7 +175,7 @@ protected Boolean isGlobalProject(String projectName) { Boolean isGlobalProject = projectsFilter.matches(projectName); - logger.atFine().log("Is global project? " + isGlobalProject); + logger.atFine().log("Is global project? %s", isGlobalProject); return isGlobalProject; } @@ -199,14 +198,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; }