From 15f33e61b74d4c65291f0ad157f89bd898f3ab96 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Mon, 2 May 2016 12:22:40 -0400 Subject: [PATCH] Kill redundant conditional in BootstrapCheck#check This commit removes an unnecessary if statement in Bootstrap#check. The removed if statement was duplicating the conditionals in the nested if statements and was merely an artifact of an earlier refactoring. --- .../bootstrap/BootstrapCheck.java | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/bootstrap/BootstrapCheck.java b/core/src/main/java/org/elasticsearch/bootstrap/BootstrapCheck.java index 72f5a9a6bdc..626e274076c 100644 --- a/core/src/main/java/org/elasticsearch/bootstrap/BootstrapCheck.java +++ b/core/src/main/java/org/elasticsearch/bootstrap/BootstrapCheck.java @@ -114,22 +114,19 @@ final class BootstrapCheck { } } - if (!errors.isEmpty() || !ignoredErrors.isEmpty()) { - - if (!ignoredErrors.isEmpty()) { - ignoredErrors.forEach(error -> log(logger, error)); - } - - if (!errors.isEmpty()) { - final List messages = new ArrayList<>(1 + errors.size()); - messages.add("bootstrap checks failed"); - messages.addAll(errors); - final RuntimeException re = new RuntimeException(String.join("\n", messages)); - errors.stream().map(IllegalStateException::new).forEach(re::addSuppressed); - throw re; - } - + if (!ignoredErrors.isEmpty()) { + ignoredErrors.forEach(error -> log(logger, error)); } + + if (!errors.isEmpty()) { + final List messages = new ArrayList<>(1 + errors.size()); + messages.add("bootstrap checks failed"); + messages.addAll(errors); + final RuntimeException re = new RuntimeException(String.join("\n", messages)); + errors.stream().map(IllegalStateException::new).forEach(re::addSuppressed); + throw re; + } + } static void log(final ESLogger logger, final String error) {