Skip to content

Commit 1b6ad96

Browse files
committed
Replace NOT operator with explicit false check - part 8 (#68625)
Part 8. We have an in-house rule to compare explicitly against `false` instead of using the logical not operator (`!`). However, this hasn't historically been enforced, meaning that there are many violations in the source at present. We now have a Checkstyle rule that can detect these cases, but before we can turn it on, we need to fix the existing violations. This is being done over a series of PRs, since there are a lot to fix.
1 parent 83bad6d commit 1b6ad96

File tree

122 files changed

+223
-205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+223
-205
lines changed

client/benchmark/src/main/java/org/elasticsearch/client/benchmark/metrics/MetricsCalculator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private static List<Metrics> calculateMetricsPerOperation(Map<String, List<Sampl
5353

5454
metrics.add(new Metrics(operationAndMetrics.getKey(),
5555
samples.stream().filter((r) -> r.isSuccess()).count(),
56-
samples.stream().filter((r) -> !r.isSuccess()).count(),
56+
samples.stream().filter((r) -> r.isSuccess() == false).count(),
5757
// throughput calculation is based on the total (Wall clock) time it took to generate all samples
5858
calculateThroughput(samples.size(), latestEnd - firstStart),
5959
// convert ns -> ms without losing precision

client/rest-high-level/src/main/java/org/elasticsearch/client/ml/job/config/DefaultDetectorDescription.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,6 @@ private static String quoteField(String field) {
8080
}
8181

8282
private static boolean isNotNullOrEmpty(String arg) {
83-
return !Strings.isNullOrEmpty(arg);
83+
return Strings.isNullOrEmpty(arg) == false;
8484
}
8585
}

libs/core/src/main/java/org/elasticsearch/common/concurrent/CompletableContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void addListener(BiConsumer<T, ? super Exception> listener) {
2727
if (t == null) {
2828
listener.accept(v, null);
2929
} else {
30-
assert !(t instanceof Error) : "Cannot be error";
30+
assert (t instanceof Error) == false: "Cannot be error";
3131
listener.accept(v, (Exception) t);
3232
}
3333
};

libs/dissect/src/main/java/org/elasticsearch/dissect/DissectParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public DissectParser(String pattern, String appendSeparator) {
117117
}
118118
this.maxMatches = matchPairs.size();
119119
this.maxResults = Long.valueOf(matchPairs.stream()
120-
.filter(dissectPair -> !dissectPair.getKey().skip()).map(KEY_NAME).distinct().count()).intValue();
120+
.filter(dissectPair -> dissectPair.getKey().skip() == false).map(KEY_NAME).distinct().count()).intValue();
121121
if (this.maxMatches == 0 || maxResults == 0) {
122122
throw new DissectException.PatternParse(pattern, "Unable to find any keys or delimiters.");
123123
}

libs/dissect/src/test/java/org/elasticsearch/dissect/DissectKeyTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public void testRightPaddingModifiers() {
112112
public void testMultipleLeftModifiers() {
113113
String keyName = randomAlphaOfLengthBetween(1, 10);
114114
List<String> validModifiers = EnumSet.allOf(DissectKey.Modifier.class).stream()
115-
.filter(m -> !m.equals(DissectKey.Modifier.NONE))
115+
.filter(m -> m.equals(DissectKey.Modifier.NONE) == false)
116116
.map(DissectKey.Modifier::toString)
117117
.collect(Collectors.toList());
118118
String modifier1 = randomFrom(validModifiers);

libs/geo/src/main/java/org/elasticsearch/geometry/utils/Geohash.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class Geohash {
5353
for(int i = 1; i <= PRECISION; i++) {
5454
precisionToLatHeight[i] = precisionToLatHeight[i-1] / (even ? 8 : 4);
5555
precisionToLonWidth[i] = precisionToLonWidth[i-1] / (even ? 4 : 8);
56-
even = ! even;
56+
even = even == false;
5757
}
5858
}
5959

libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/SslClientAuthenticationMode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public boolean enabled() {
2929

3030
public void configure(SSLParameters sslParameters) {
3131
// nothing to do here
32-
assert !sslParameters.getWantClientAuth();
33-
assert !sslParameters.getNeedClientAuth();
32+
assert sslParameters.getWantClientAuth() == false;
33+
assert sslParameters.getNeedClientAuth() == false;
3434
}
3535
},
3636
/**

libs/x-content/src/main/java/org/elasticsearch/common/xcontent/support/filtering/FilterPathBasedFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,6 @@ public TokenFilter includeProperty(String name) {
9292

9393
@Override
9494
protected boolean _includeScalar() {
95-
return !inclusive;
95+
return inclusive == false;
9696
}
9797
}

server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotIndexShardStatus.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.elasticsearch.index.snapshots.IndexShardSnapshotStatus;
2626

2727
import java.io.IOException;
28+
import java.util.Objects;
2829

2930
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.constructorArg;
3031
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg;
@@ -199,15 +200,17 @@ public static SnapshotIndexShardStatus fromXContent(XContentParser parser, Strin
199200

200201
@Override
201202
public boolean equals(Object o) {
202-
if (this == o) return true;
203-
if (o == null || getClass() != o.getClass()) return false;
204-
203+
if (this == o) {
204+
return true;
205+
}
206+
if (o == null || getClass() != o.getClass()) {
207+
return false;
208+
}
205209
SnapshotIndexShardStatus that = (SnapshotIndexShardStatus) o;
206-
207-
if (stage != that.stage) return false;
208-
if (stats != null ? !stats.equals(that.stats) : that.stats != null) return false;
209-
if (nodeId != null ? !nodeId.equals(that.nodeId) : that.nodeId != null) return false;
210-
return failure != null ? failure.equals(that.failure) : that.failure == null;
210+
return stage == that.stage
211+
&& Objects.equals(stats, that.stats)
212+
&& Objects.equals(nodeId, that.nodeId)
213+
&& Objects.equals(failure, that.failure);
211214
}
212215

213216
@Override

server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotIndexStatus.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.util.Iterator;
2323
import java.util.List;
2424
import java.util.Map;
25+
import java.util.Objects;
2526

2627
import static java.util.Collections.emptyMap;
2728
import static java.util.Collections.unmodifiableMap;
@@ -149,15 +150,17 @@ public static SnapshotIndexStatus fromXContent(XContentParser parser) throws IOE
149150

150151
@Override
151152
public boolean equals(Object o) {
152-
if (this == o) return true;
153-
if (o == null || getClass() != o.getClass()) return false;
154-
153+
if (this == o) {
154+
return true;
155+
}
156+
if (o == null || getClass() != o.getClass()) {
157+
return false;
158+
}
155159
SnapshotIndexStatus that = (SnapshotIndexStatus) o;
156-
157-
if (index != null ? !index.equals(that.index) : that.index != null) return false;
158-
if (indexShards != null ? !indexShards.equals(that.indexShards) : that.indexShards != null) return false;
159-
if (shardsStats != null ? !shardsStats.equals(that.shardsStats) : that.shardsStats != null) return false;
160-
return stats != null ? stats.equals(that.stats) : that.stats == null;
160+
return Objects.equals(index, that.index)
161+
&& Objects.equals(indexShards, that.indexShards)
162+
&& Objects.equals(shardsStats, that.shardsStats)
163+
&& Objects.equals(stats, that.stats);
161164
}
162165

163166
@Override

server/src/main/java/org/elasticsearch/action/admin/indices/alias/Alias.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.io.IOException;
2929
import java.io.InputStream;
3030
import java.util.Map;
31+
import java.util.Objects;
3132

3233
/**
3334
* Represents an alias, to be associated with an index
@@ -302,9 +303,7 @@ public boolean equals(Object o) {
302303

303304
Alias alias = (Alias) o;
304305

305-
if (name != null ? !name.equals(alias.name) : alias.name != null) return false;
306-
307-
return true;
306+
return Objects.equals(name, alias.name);
308307
}
309308

310309
@Override

server/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
498498
if (positionLength > 1) {
499499
builder.field(POSITION_LENGTH, positionLength);
500500
}
501-
if (attributes != null && !attributes.isEmpty()) {
501+
if (attributes != null && attributes.isEmpty() == false) {
502502
Map<String, Object> sortedAttributes = new TreeMap<>(attributes);
503503
for (Map.Entry<String, Object> entity : sortedAttributes.entrySet()) {
504504
builder.field(entity.getKey(), entity.getValue());

server/src/main/java/org/elasticsearch/action/admin/indices/stats/CommonStatsFlags.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public CommonStatsFlags clear() {
105105
}
106106

107107
public boolean anySet() {
108-
return !flags.isEmpty();
108+
return flags.isEmpty() == false;
109109
}
110110

111111
public Flag[] getFlags() {

server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public ActionRequestValidationException validate() {
4949
validationException = addValidationError("names is null or empty", validationException);
5050
} else {
5151
for (String name : names) {
52-
if (name == null || !Strings.hasText(name)) {
52+
if (name == null || Strings.hasText(name) == false) {
5353
validationException = addValidationError("name is missing", validationException);
5454
}
5555
}

server/src/main/java/org/elasticsearch/action/admin/indices/validate/query/ValidateQueryResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public void writeTo(StreamOutput out) throws IOException {
101101
@Override
102102
protected void addCustomXContentFields(XContentBuilder builder, Params params) throws IOException {
103103
builder.field(VALID_FIELD, isValid());
104-
if (getQueryExplanation() != null && !getQueryExplanation().isEmpty()) {
104+
if (getQueryExplanation() != null && getQueryExplanation().isEmpty() == false) {
105105
builder.startArray(EXPLANATIONS_FIELD);
106106
for (QueryExplanation explanation : getQueryExplanation()) {
107107
builder.startObject();

server/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,14 +464,14 @@ private void applyGlobalMandatoryParameters(DocWriteRequest<?> request) {
464464
}
465465

466466
private static String valueOrDefault(String value, String globalDefault) {
467-
if (Strings.isNullOrEmpty(value) && !Strings.isNullOrEmpty(globalDefault)) {
467+
if (Strings.isNullOrEmpty(value) && Strings.isNullOrEmpty(globalDefault) == false) {
468468
return globalDefault;
469469
}
470470
return value;
471471
}
472472

473473
private static Boolean valueOrDefault(Boolean value, Boolean globalDefault) {
474-
if (Objects.isNull(value) && !Objects.isNull(globalDefault)) {
474+
if (Objects.isNull(value) && Objects.isNull(globalDefault) == false) {
475475
return globalDefault;
476476
}
477477
return value;

server/src/main/java/org/elasticsearch/action/bulk/Retry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public void onResponse(BulkResponse bulkItemResponses) {
9797
finishHim();
9898
} else {
9999
if (canRetry(bulkItemResponses)) {
100-
addResponses(bulkItemResponses, (r -> !r.isFailed()));
100+
addResponses(bulkItemResponses, (r -> r.isFailed() == false));
101101
retry(createBulkRequestForRetry(bulkItemResponses));
102102
} else {
103103
addResponses(bulkItemResponses, (r -> true));

server/src/main/java/org/elasticsearch/action/get/TransportGetAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ protected GetResponse shardOperation(GetRequest request, ShardId shardId) {
8888
IndexService indexService = indicesService.indexServiceSafe(shardId.getIndex());
8989
IndexShard indexShard = indexService.getShard(shardId.id());
9090

91-
if (request.refresh() && !request.realtime()) {
91+
if (request.refresh() && request.realtime() == false) {
9292
indexShard.refresh("refresh_flag_get");
9393
}
9494

server/src/main/java/org/elasticsearch/action/get/TransportShardMultiGetAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ protected MultiGetShardResponse shardOperation(MultiGetShardRequest request, Sha
8888
IndexService indexService = indicesService.indexServiceSafe(shardId.getIndex());
8989
IndexShard indexShard = indexService.getShard(shardId.id());
9090

91-
if (request.refresh() && !request.realtime()) {
91+
if (request.refresh() && request.realtime() == false) {
9292
indexShard.refresh("refresh_flag_mget");
9393
}
9494

server/src/main/java/org/elasticsearch/action/ingest/GetPipelineResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void writeTo(StreamOutput out) throws IOException {
6464
}
6565

6666
public boolean isFound() {
67-
return !pipelines.isEmpty();
67+
return pipelines.isEmpty() == false;
6868
}
6969

7070
@Override

server/src/main/java/org/elasticsearch/action/search/SearchPhaseController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public AggregatedDfs aggregateDfs(Collection<DfsSearchResult> results) {
9797

9898
}
9999

100-
assert !lEntry.fieldStatistics().containsKey(null);
100+
assert lEntry.fieldStatistics().containsKey(null) == false;
101101
final Object[] keys = lEntry.fieldStatistics().keys;
102102
final Object[] values = lEntry.fieldStatistics().values;
103103
for (int i = 0; i < keys.length; i++) {

server/src/main/java/org/elasticsearch/action/support/TransportActions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static boolean isShardNotAvailableException(final Throwable e) {
3232
* If a failure is already present, should this failure override it or not for read operations.
3333
*/
3434
public static boolean isReadOverrideException(Exception e) {
35-
return !isShardNotAvailableException(e);
35+
return isShardNotAvailableException(e) == false;
3636
}
3737

3838
}

server/src/main/java/org/elasticsearch/action/support/broadcast/node/TransportBroadcastByNodeAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ protected void onNodeResponse(DiscoveryNode node, int nodeIndex, NodeResponse re
352352

353353
protected void onNodeFailure(DiscoveryNode node, int nodeIndex, Throwable t) {
354354
String nodeId = node.getId();
355-
if (logger.isDebugEnabled() && !(t instanceof NodeShouldNotConnectException)) {
355+
if (logger.isDebugEnabled() && (t instanceof NodeShouldNotConnectException) == false) {
356356
logger.debug(new ParameterizedMessage("failed to execute [{}] on node [{}]", actionName, nodeId), t);
357357
}
358358

server/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ protected void doStart(ClusterState clusterState) {
133133
retry(clusterState, blockException, newState -> {
134134
try {
135135
ClusterBlockException newException = checkBlock(request, newState);
136-
return (newException == null || !newException.retryable());
136+
return (newException == null || newException.retryable() == false);
137137
} catch (Exception e) {
138138
// accept state as block will be rechecked by doStart() and listener.onFailure() then called
139139
logger.trace("exception occurred during cluster block checking, accepting state", e);

server/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ private void onOperation(int idx, NodeResponse nodeResponse) {
231231
}
232232

233233
private void onFailure(int idx, String nodeId, Throwable t) {
234-
if (logger.isDebugEnabled() && !(t instanceof NodeShouldNotConnectException)) {
234+
if (logger.isDebugEnabled() && (t instanceof NodeShouldNotConnectException) == false) {
235235
logger.debug(new ParameterizedMessage("failed to execute on node [{}]", nodeId), t);
236236
}
237237
responses.set(idx, new FailedNodeException(nodeId, "Failed node [" + nodeId + "]", t));

server/src/main/java/org/elasticsearch/action/support/tasks/TransportTasksAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ private void onOperation(int idx, NodeTasksResponse nodeResponse) {
279279
}
280280

281281
private void onFailure(int idx, String nodeId, Throwable t) {
282-
if (logger.isDebugEnabled() && !(t instanceof NodeShouldNotConnectException)) {
282+
if (logger.isDebugEnabled() && (t instanceof NodeShouldNotConnectException) == false) {
283283
logger.debug(new ParameterizedMessage("failed to execute on node [{}]", nodeId), t);
284284
}
285285

server/src/main/java/org/elasticsearch/action/termvectors/TermVectorsRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ private void setFlag(Flag flag, boolean set) {
502502
flagsEnum.add(flag);
503503
} else if (set == false) {
504504
flagsEnum.remove(flag);
505-
assert (!flagsEnum.contains(flag));
505+
assert flagsEnum.contains(flag) == false;
506506
}
507507
}
508508

server/src/main/java/org/elasticsearch/action/termvectors/TermVectorsWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void setFields(Fields termVectorsByField, Set<String> selectedFields, EnumSet<Fl
4848
boolean hasScores = termVectorsFilter != null;
4949

5050
for (String field : termVectorsByField) {
51-
if ((selectedFields != null) && (!selectedFields.contains(field))) {
51+
if (selectedFields != null && selectedFields.contains(field) == false) {
5252
continue;
5353
}
5454

@@ -85,7 +85,7 @@ void setFields(Fields termVectorsByField, Set<String> selectedFields, EnumSet<Fl
8585
Term term = new Term(field, termBytesRef);
8686

8787
// with filtering we only keep the best terms
88-
if (hasScores && !termVectorsFilter.hasScoreTerm(term)) {
88+
if (hasScores && termVectorsFilter.hasScoreTerm(term) == false) {
8989
continue;
9090
}
9191

server/src/main/java/org/elasticsearch/action/update/UpdateHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Tuple<UpdateOpType, Map<String, Object>> executeScriptedUpsert(Map<String, Objec
113113
* {@code IndexRequest} to be executed on the primary and replicas.
114114
*/
115115
Result prepareUpsert(ShardId shardId, UpdateRequest request, final GetResult getResult, LongSupplier nowInMillis) {
116-
if (request.upsertRequest() == null && !request.docAsUpsert()) {
116+
if (request.upsertRequest() == null && request.docAsUpsert() == false) {
117117
throw new DocumentMissingException(shardId, request.type(), request.id());
118118
}
119119
IndexRequest indexRequest = request.docAsUpsert() ? request.doc() : request.upsertRequest();
@@ -176,7 +176,7 @@ Result prepareUpdateIndexRequest(ShardId shardId, UpdateRequest request, GetResu
176176
final XContentType updateSourceContentType = sourceAndContent.v1();
177177
final Map<String, Object> updatedSourceAsMap = sourceAndContent.v2();
178178

179-
final boolean noop = !XContentHelper.update(updatedSourceAsMap, currentRequest.sourceAsMap(), detectNoop);
179+
final boolean noop = XContentHelper.update(updatedSourceAsMap, currentRequest.sourceAsMap(), detectNoop) == false;
180180

181181
// We can only actually turn the update into a noop if detectNoop is true to preserve backwards compatibility and to handle cases
182182
// where users repopulating multi-fields or adding synonyms, etc.

server/src/main/java/org/elasticsearch/bootstrap/BootstrapCheck.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public boolean isSuccess() {
4242
}
4343

4444
public boolean isFailure() {
45-
return !isSuccess();
45+
return isSuccess() == false;
4646
}
4747

4848
public String getMessage() {

server/src/main/java/org/elasticsearch/bootstrap/BootstrapChecks.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ static void log(final Logger logger, final String error) {
172172
static boolean enforceLimits(final BoundTransportAddress boundTransportAddress, final String discoveryType) {
173173
final Predicate<TransportAddress> isLoopbackAddress = t -> t.address().getAddress().isLoopbackAddress();
174174
final boolean bound =
175-
!(Arrays.stream(boundTransportAddress.boundAddresses()).allMatch(isLoopbackAddress) &&
176-
isLoopbackAddress.test(boundTransportAddress.publishAddress()));
177-
return bound && !"single-node".equals(discoveryType);
175+
(Arrays.stream(boundTransportAddress.boundAddresses()).allMatch(isLoopbackAddress) &&
176+
isLoopbackAddress.test(boundTransportAddress.publishAddress())) == false;
177+
return bound && "single-node".equals(discoveryType) == false;
178178
}
179179

180180
// the list of checks to execute
@@ -578,7 +578,7 @@ static class OnErrorCheck extends MightForkCheck {
578578
@Override
579579
boolean mightFork() {
580580
final String onError = onError();
581-
return onError != null && !onError.equals("");
581+
return onError != null && onError.isEmpty() == false;
582582
}
583583

584584
// visible for testing
@@ -603,7 +603,7 @@ static class OnOutOfMemoryErrorCheck extends MightForkCheck {
603603
@Override
604604
boolean mightFork() {
605605
final String onOutOfMemoryError = onOutOfMemoryError();
606-
return onOutOfMemoryError != null && !onOutOfMemoryError.equals("");
606+
return onOutOfMemoryError != null && onOutOfMemoryError.isEmpty() == false;
607607
}
608608

609609
// visible for testing

server/src/main/java/org/elasticsearch/bootstrap/Elasticsearch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ protected void execute(Terminal terminal, OptionSet options, Environment env) th
156156
void init(final boolean daemonize, final Path pidFile, final boolean quiet, Environment initialEnv)
157157
throws NodeValidationException, UserException {
158158
try {
159-
Bootstrap.init(!daemonize, pidFile, quiet, initialEnv);
159+
Bootstrap.init(daemonize == false, pidFile, quiet, initialEnv);
160160
} catch (BootstrapException | RuntimeException e) {
161161
// format exceptions to the console in a special way
162162
// to avoid 2MB stacktraces from guice, etc.

0 commit comments

Comments
 (0)