diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/NoticeTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/NoticeTask.groovy index 92f81c6dae5f3..f0ad5150560ce 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/NoticeTask.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/NoticeTask.groovy @@ -124,7 +124,7 @@ class NoticeTask extends DefaultTask { if (line.contains('*/')) { inNotice = false - if (!isPackageInfo) { + if (isPackageInfo == false) { break } } else if (inNotice) { diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/ElasticsearchDistribution.java b/buildSrc/src/main/java/org/elasticsearch/gradle/ElasticsearchDistribution.java index 47cfcd2103d17..08069c8fad231 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/ElasticsearchDistribution.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/ElasticsearchDistribution.java @@ -105,7 +105,7 @@ public String toString() { private final Property failIfUnavailable; private final Configuration extracted; private Action distributionFinalizer; - private boolean froozen = false; + private boolean frozen = false; ElasticsearchDistribution( String name, @@ -207,10 +207,10 @@ public String toString() { * runs distribution finalizer logic. */ public ElasticsearchDistribution maybeFreeze() { - if (!froozen) { + if (frozen == false) { finalizeValues(); distributionFinalizer.execute(this); - froozen = true; + frozen = true; } return this; } diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionDownloadPlugin.java b/buildSrc/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionDownloadPlugin.java index 55a450d56072b..9bc3554200fc4 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionDownloadPlugin.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionDownloadPlugin.java @@ -83,7 +83,7 @@ private void registerInternalDistributionResolutions(NamedDomainObjectContainer< resolutions.register("bwc", distributionResolution -> distributionResolution.setResolver((project, distribution) -> { BwcVersions.UnreleasedVersionInfo unreleasedInfo = bwcVersions.unreleasedInfo(Version.fromString(distribution.getVersion())); if (unreleasedInfo != null) { - if (!distribution.getBundledJdk()) { + if (distribution.getBundledJdk() == false) { throw new GradleException( "Configuring a snapshot bwc distribution ('" + distribution.getName() diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/internal/precommit/FilePermissionsTask.java b/buildSrc/src/main/java/org/elasticsearch/gradle/internal/precommit/FilePermissionsTask.java index 929920d703f1c..e9c5dd74e29c0 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/internal/precommit/FilePermissionsTask.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/internal/precommit/FilePermissionsTask.java @@ -106,7 +106,7 @@ public void checkInvalidPermissions() throws IOException { .map(file -> "Source file is executable: " + file) .collect(Collectors.toList()); - if (!failures.isEmpty()) { + if (failures.isEmpty() == false) { throw new GradleException("Found invalid file permissions:\n" + String.join("\n", failures)); } diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java b/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java index 12cb12d57c02f..f14fdaade606e 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java @@ -1267,7 +1267,7 @@ private void tweakJvmOptions(Path configFileRoot) { String content = new String(Files.readAllBytes(jvmOptions)); Map expansions = jvmOptionExpansions(); for (String origin : expansions.keySet()) { - if (!content.contains(origin)) { + if (content.contains(origin) == false) { throw new IOException("template property " + origin + " not found in template."); } content = content.replace(origin, expansions.get(origin)); diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/util/FileUtils.java b/buildSrc/src/main/java/org/elasticsearch/gradle/util/FileUtils.java index f8e8b5a39c5e5..adf9f7a5c40d0 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/util/FileUtils.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/util/FileUtils.java @@ -39,13 +39,13 @@ public static void mkdirs(File dir) { return; } - if (dir.exists() && !dir.isDirectory()) { + if (dir.exists() && dir.isDirectory() == false) { throw new UncheckedIOException(String.format("Cannot create directory '%s' as it already exists, but is not a directory", dir)); } List toCreate = new LinkedList(); File parent = dir.getParentFile(); - while (!parent.exists()) { + while (parent.exists() == false) { toCreate.add(parent); parent = parent.getParentFile(); } @@ -55,7 +55,7 @@ public static void mkdirs(File dir) { continue; } File parentDirToCreateParent = parentDirToCreate.getParentFile(); - if (!parentDirToCreateParent.isDirectory()) { + if (parentDirToCreateParent.isDirectory() == false) { throw new UncheckedIOException( String.format( "Cannot create parent directory '%s' when creating directory '%s' as '%s' is not a directory", @@ -65,13 +65,13 @@ public static void mkdirs(File dir) { ) ); } - if (!parentDirToCreate.mkdir() && !parentDirToCreate.isDirectory()) { + if (parentDirToCreate.mkdir() == false && parentDirToCreate.isDirectory() == false) { throw new UncheckedIOException( String.format("Failed to create parent directory '%s' when creating directory '%s'", parentDirToCreate, dir) ); } } - if (!dir.mkdir() && !dir.isDirectory()) { + if (dir.mkdir() == false && dir.isDirectory() == false) { throw new UncheckedIOException(String.format("Failed to create directory '%s'", dir)); } } diff --git a/buildSrc/src/main/resources/checkstyle_ide_fragment.xml b/buildSrc/src/main/resources/checkstyle_ide_fragment.xml index 1dde8eba29a59..4cd487157f694 100644 --- a/buildSrc/src/main/resources/checkstyle_ide_fragment.xml +++ b/buildSrc/src/main/resources/checkstyle_ide_fragment.xml @@ -15,7 +15,7 @@ - + diff --git a/client/benchmark/src/main/java/org/elasticsearch/client/benchmark/metrics/MetricsCalculator.java b/client/benchmark/src/main/java/org/elasticsearch/client/benchmark/metrics/MetricsCalculator.java index a0be3d901d3cb..573cf2a533c1e 100644 --- a/client/benchmark/src/main/java/org/elasticsearch/client/benchmark/metrics/MetricsCalculator.java +++ b/client/benchmark/src/main/java/org/elasticsearch/client/benchmark/metrics/MetricsCalculator.java @@ -37,7 +37,7 @@ private static Map> groupByOperation(Collection sam Map> samplesPerOperation = new HashMap<>(); for (Sample sample : samples) { - if (!samplesPerOperation.containsKey(sample.getOperation())) { + if (samplesPerOperation.containsKey(sample.getOperation()) == false) { samplesPerOperation.put(sample.getOperation(), new ArrayList<>()); } samplesPerOperation.get(sample.getOperation()).add(sample); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/IngestRequestConverters.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/IngestRequestConverters.java index c2ffc4ee5da4d..45e7e00a4fb9f 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/IngestRequestConverters.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/IngestRequestConverters.java @@ -78,7 +78,7 @@ static Request deletePipeline(DeletePipelineRequest deletePipelineRequest) { static Request simulatePipeline(SimulatePipelineRequest simulatePipelineRequest) throws IOException { RequestConverters.EndpointBuilder builder = new RequestConverters.EndpointBuilder().addPathPartAsIs("_ingest/pipeline"); - if (simulatePipelineRequest.getId() != null && !simulatePipelineRequest.getId().isEmpty()) { + if (simulatePipelineRequest.getId() != null && simulatePipelineRequest.getId().isEmpty() == false) { builder.addPathPart(simulatePipelineRequest.getId()); } builder.addPathPartAsIs("_simulate"); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/GetAutoFollowPatternResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/GetAutoFollowPatternResponse.java index 8db6de0a52844..3cdf95cfc68c6 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/GetAutoFollowPatternResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/GetAutoFollowPatternResponse.java @@ -158,7 +158,7 @@ public String getFollowIndexNamePattern() { public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; + if (super.equals(o) == false) return false; Pattern pattern = (Pattern) o; return Objects.equals(remoteCluster, pattern.remoteCluster) && Objects.equals(leaderIndexPatterns, pattern.leaderIndexPatterns) && diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/PutAutoFollowPatternRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/PutAutoFollowPatternRequest.java index e28d825c4e432..f0e1d6ecd463c 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/PutAutoFollowPatternRequest.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/PutAutoFollowPatternRequest.java @@ -81,7 +81,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; + if (super.equals(o) == false) return false; PutAutoFollowPatternRequest that = (PutAutoFollowPatternRequest) o; return Objects.equals(name, that.name) && Objects.equals(remoteCluster, that.remoteCluster) && diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/PutFollowRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/PutFollowRequest.java index 9c9e3f92b8173..be91f4c486dcf 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/PutFollowRequest.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/PutFollowRequest.java @@ -79,7 +79,7 @@ public ActiveShardCount waitForActiveShards() { public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; + if (super.equals(o) == false) return false; PutFollowRequest that = (PutFollowRequest) o; return Objects.equals(waitForActiveShards, that.waitForActiveShards) && Objects.equals(remoteCluster, that.remoteCluster) && diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/ResumeFollowRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/ResumeFollowRequest.java index 972f327134749..5ac3d178e7012 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/ResumeFollowRequest.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/ccr/ResumeFollowRequest.java @@ -50,7 +50,7 @@ public String getFollowerIndex() { public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; + if (super.equals(o) == false) return false; ResumeFollowRequest that = (ResumeFollowRequest) o; return Objects.equals(followerIndex, that.followerIndex); } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/core/MultiTermVectorsResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/core/MultiTermVectorsResponse.java index ea58e93eb9e34..f0d56ae052cee 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/core/MultiTermVectorsResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/core/MultiTermVectorsResponse.java @@ -64,7 +64,7 @@ public List getTermVectorsResponses() { @Override public boolean equals(Object obj) { if (this == obj) return true; - if (!(obj instanceof MultiTermVectorsResponse)) return false; + if ((obj instanceof MultiTermVectorsResponse) == false) return false; MultiTermVectorsResponse other = (MultiTermVectorsResponse) obj; return Objects.equals(responses, other.responses); } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/core/TermVectorsResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/core/TermVectorsResponse.java index e448ba075a688..8d35dd57a6e72 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/core/TermVectorsResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/core/TermVectorsResponse.java @@ -23,14 +23,15 @@ import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.XContentParser; -import static org.elasticsearch.common.xcontent.ConstructingObjectParser.constructorArg; -import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg; import java.util.Collections; -import java.util.List; import java.util.Comparator; +import java.util.List; import java.util.Objects; +import static org.elasticsearch.common.xcontent.ConstructingObjectParser.constructorArg; +import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg; + public class TermVectorsResponse { private final String index; private final String type; @@ -142,7 +143,7 @@ public List getTermVectorsList(){ @Override public boolean equals(Object obj) { if (this == obj) return true; - if (!(obj instanceof TermVectorsResponse)) return false; + if ((obj instanceof TermVectorsResponse) == false) return false; TermVectorsResponse other = (TermVectorsResponse) obj; return index.equals(other.index) && type.equals(other.type) @@ -219,7 +220,7 @@ public FieldStatistics getFieldStatistics() { @Override public boolean equals(Object obj) { if (this == obj) return true; - if (!(obj instanceof TermVector)) return false; + if ((obj instanceof TermVector) == false) return false; TermVector other = (TermVector) obj; return fieldName.equals(other.fieldName) && Objects.equals(fieldStatistics, other.fieldStatistics) @@ -283,7 +284,7 @@ public long getSumTotalTermFreq() { @Override public boolean equals(Object obj) { if (this == obj) return true; - if (!(obj instanceof FieldStatistics)) return false; + if ((obj instanceof FieldStatistics) == false) return false; FieldStatistics other = (FieldStatistics) obj; return docCount == other.docCount && sumDocFreq == other.sumDocFreq @@ -390,7 +391,7 @@ public List getTokens() { @Override public boolean equals(Object obj) { if (this == obj) return true; - if (!(obj instanceof Term)) return false; + if ((obj instanceof Term) == false) return false; Term other = (Term) obj; return term.equals(other.term) && termFreq == other.termFreq @@ -472,7 +473,7 @@ public String getPayload() { @Override public boolean equals(Object obj) { if (this == obj) return true; - if (!(obj instanceof Token)) return false; + if ((obj instanceof Token) == false) return false; Token other = (Token) obj; return Objects.equals(startOffset, other.startOffset) && Objects.equals(endOffset,other.endOffset) diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/graph/Connection.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/graph/Connection.java index 07aff3888d260..80a39b41d2ecd 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/graph/Connection.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/graph/Connection.java @@ -34,7 +34,7 @@ import static org.elasticsearch.common.xcontent.ConstructingObjectParser.constructorArg; /** - * A Connection links exactly two {@link Vertex} objects. The basis of a + * A Connection links exactly two {@link Vertex} objects. The basis of a * connection is one or more documents have been found that contain * this pair of terms and the strength of the connection is recorded * as a weight. @@ -75,13 +75,13 @@ public double getWeight() { } /** - * @return the number of documents in the sampled set that contained this + * @return the number of documents in the sampled set that contained this * pair of {@link Vertex} objects. */ public long getDocCount() { return docCount; } - + @Override public boolean equals(Object obj) { if (this == obj) @@ -107,7 +107,7 @@ public int hashCode() { private static final ParseField TARGET = new ParseField("target"); private static final ParseField WEIGHT = new ParseField("weight"); private static final ParseField DOC_COUNT = new ParseField("doc_count"); - + void toXContent(XContentBuilder builder, Params params, ObjectIntHashMap vertexNumbers) throws IOException { builder.field(SOURCE.getPreferredName(), vertexNumbers.get(from)); @@ -131,10 +131,10 @@ static class UnresolvedConnection { this.weight = weight; this.docCount = docCount; } - public Connection resolve(List vertices) { + public Connection resolve(List vertices) { return new Connection(vertices.get(fromIndex), vertices.get(toIndex), weight, docCount); } - + private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>( "ConnectionParser", true, args -> { @@ -150,13 +150,13 @@ public Connection resolve(List vertices) { PARSER.declareInt(constructorArg(), TARGET); PARSER.declareDouble(constructorArg(), WEIGHT); PARSER.declareLong(constructorArg(), DOC_COUNT); - } + } static UnresolvedConnection fromXContent(XContentParser parser) throws IOException { return PARSER.apply(parser, null); - } + } } - - + + /** * An identifier (implements hashcode and equals) that represents a * unique key for a {@link Connection} @@ -179,9 +179,9 @@ public boolean equals(Object o) { ConnectionId vertexId = (ConnectionId) o; - if (source != null ? !source.equals(vertexId.source) : vertexId.source != null) + if (source != null ? source.equals(vertexId.source) == false : vertexId.source != null) return false; - if (target != null ? !target.equals(vertexId.target) : vertexId.target != null) + if (target != null ? target.equals(vertexId.target) == false : vertexId.target != null) return false; return true; @@ -206,5 +206,5 @@ public VertexId getTarget() { public String toString() { return getSource() + "->" + getTarget(); } - } + } } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/graph/Vertex.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/graph/Vertex.java index 54b0b5223277d..b66821f75c5e5 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/graph/Vertex.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/graph/Vertex.java @@ -33,9 +33,9 @@ /** * A vertex in a graph response represents a single term (a field and value pair) * which appears in one or more documents found as part of the graph exploration. - * - * A vertex term could be a bank account number, an email address, a hashtag or any - * other term that appears in documents and is interesting to represent in a network. + * + * A vertex term could be a bank account number, an email address, a hashtag or any + * other term that appears in documents and is interesting to represent in a network. */ public class Vertex implements ToXContentFragment { @@ -51,7 +51,7 @@ public class Vertex implements ToXContentFragment { private static final ParseField DEPTH = new ParseField("depth"); private static final ParseField FG = new ParseField("fg"); private static final ParseField BG = new ParseField("bg"); - + public Vertex(String field, String term, double weight, int depth, long bg, long fg) { super(); @@ -62,12 +62,12 @@ public Vertex(String field, String term, double weight, int depth, long bg, long this.bg = bg; this.fg = fg; } - + @Override public int hashCode() { return Objects.hash(field, term, weight, depth, bg, fg); - } - + } + @Override public boolean equals(Object obj) { if (this == obj) @@ -83,8 +83,8 @@ public boolean equals(Object obj) { fg == other.fg && Objects.equals(field, other.field) && Objects.equals(term, other.term); - - } + + } @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { @@ -99,8 +99,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws } return builder; } - - + + private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>( "VertexParser", true, args -> { @@ -122,12 +122,12 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws PARSER.declareInt(constructorArg(), DEPTH); PARSER.declareLong(optionalConstructorArg(), BG); PARSER.declareLong(optionalConstructorArg(), FG); - } - + } + static Vertex fromXContent(XContentParser parser) throws IOException { return PARSER.apply(parser, null); } - + /** * @return a {@link VertexId} object that uniquely identifies this Vertex @@ -175,22 +175,22 @@ public void setWeight(final double weight) { /** * If the {@link GraphExploreRequest#useSignificance(boolean)} is true (the default) - * this statistic is available. - * @return the number of documents in the index that contain this term (see bg_count in + * this statistic is available. + * @return the number of documents in the index that contain this term (see bg_count in * - * the significant_terms aggregation) + * the significant_terms aggregation) */ public long getBg() { return bg; } /** - * If the {@link GraphExploreRequest#useSignificance(boolean)} is true (the default) - * this statistic is available. + * If the {@link GraphExploreRequest#useSignificance(boolean)} is true (the default) + * this statistic is available. * Together with {@link #getBg()} these numbers are used to derive the significance of a term. - * @return the number of documents in the sample of best matching documents that contain this term (see fg_count in + * @return the number of documents in the sample of best matching documents that contain this term (see fg_count in * - * the significant_terms aggregation) + * the significant_terms aggregation) */ public long getFg() { return fg; @@ -206,7 +206,7 @@ public void setFg(final long fg) { public int getHopDepth() { return depth; } - + /** * An identifier (implements hashcode and equals) that represents a * unique key for a {@link Vertex} @@ -237,9 +237,9 @@ public boolean equals(Object o) { VertexId vertexId = (VertexId) o; - if (field != null ? !field.equals(vertexId.field) : vertexId.field != null) + if (field != null ? field.equals(vertexId.field) == false : vertexId.field != null) return false; - if (term != null ? !term.equals(vertexId.term) : vertexId.term != null) + if (term != null ? term.equals(vertexId.term) == false : vertexId.term != null) return false; return true; @@ -256,6 +256,6 @@ public int hashCode() { public String toString() { return field + ":" + term; } - } + } } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indexlifecycle/GetLifecyclePolicyResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indexlifecycle/GetLifecyclePolicyResponse.java index 0d78f843064ce..39c2c0c3a73ee 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indexlifecycle/GetLifecyclePolicyResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/indexlifecycle/GetLifecyclePolicyResponse.java @@ -63,7 +63,7 @@ public static GetLifecyclePolicyResponse fromXContent(XContentParser parser) thr ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.currentToken(), parser); parser.nextToken(); - while (!parser.isClosed()) { + while (parser.isClosed() == false) { if (parser.currentToken() == XContentParser.Token.START_OBJECT) { String policyName = parser.currentName(); LifecyclePolicyMetadata policyDefinion = LifecyclePolicyMetadata.parse(parser, policyName); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetFieldMappingsResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetFieldMappingsResponse.java index cdf9db287ca29..b41c8fc8cdf12 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetFieldMappingsResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetFieldMappingsResponse.java @@ -157,7 +157,7 @@ public String toString() { @Override public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof FieldMappingMetadata)) return false; + if ((o instanceof FieldMappingMetadata) == false) return false; FieldMappingMetadata that = (FieldMappingMetadata) o; return Objects.equals(fullName, that.fullName) && Objects.equals(source, that.source); } @@ -177,7 +177,7 @@ public String toString() { @Override public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof GetFieldMappingsResponse)) return false; + if ((o instanceof GetFieldMappingsResponse) == false) return false; GetFieldMappingsResponse that = (GetFieldMappingsResponse) o; return Objects.equals(mappings, that.mappings); } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetIndexResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetIndexResponse.java index a0abc7f9fe703..9b19252b77061 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetIndexResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetIndexResponse.java @@ -216,7 +216,7 @@ public static GetIndexResponse fromXContent(XContentParser parser) throws IOExce ensureExpectedToken(Token.START_OBJECT, parser.currentToken(), parser); parser.nextToken(); - while (!parser.isClosed()) { + while (parser.isClosed() == false) { if (parser.currentToken() == Token.START_OBJECT) { // we assume this is an index entry String indexName = parser.currentName(); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/ResizeResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/ResizeResponse.java index f46ebbed0c6e4..b0c5782dccd3a 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/ResizeResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/indices/ResizeResponse.java @@ -64,7 +64,7 @@ public static ResizeResponse fromXContent(XContentParser parser) { public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; + if (super.equals(o) == false) return false; ResizeResponse that = (ResizeResponse) o; return Objects.equals(index, that.index); } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/license/PutLicenseResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/license/PutLicenseResponse.java index 107aec76f974b..a190e17acd35b 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/license/PutLicenseResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/license/PutLicenseResponse.java @@ -136,7 +136,7 @@ public static PutLicenseResponse fromXContent(XContentParser parser) throws IOEx public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; + if (super.equals(o) == false) return false; PutLicenseResponse that = (PutLicenseResponse) o; return status == that.status && diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/security/GetUsersRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/security/GetUsersRequest.java index 0a6b5e9bb2578..8a66374b5c4b2 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/security/GetUsersRequest.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/security/GetUsersRequest.java @@ -46,7 +46,7 @@ public Set getUsernames() { @Override public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof GetUsersRequest)) return false; + if ((o instanceof GetUsersRequest) == false) return false; GetUsersRequest that = (GetUsersRequest) o; return Objects.equals(usernames, that.usernames); } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/security/GetUsersResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/security/GetUsersResponse.java index a2fa121b6fb5b..b21e0f7fee236 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/security/GetUsersResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/security/GetUsersResponse.java @@ -77,7 +77,7 @@ public static GetUsersResponse fromXContent(XContentParser parser) throws IOExce @Override public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof GetUsersResponse)) return false; + if ((o instanceof GetUsersResponse) == false) return false; GetUsersResponse that = (GetUsersResponse) o; return Objects.equals(users, that.users); } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/CancelTasksRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/CancelTasksRequest.java index 15eb7cfd20f71..49ead819a6f2a 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/CancelTasksRequest.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/CancelTasksRequest.java @@ -88,7 +88,7 @@ public void setWaitForCompletion(boolean waitForCompletion) { @Override public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof CancelTasksRequest)) return false; + if ((o instanceof CancelTasksRequest) == false) return false; CancelTasksRequest that = (CancelTasksRequest) o; return Objects.equals(getNodes(), that.getNodes()) && Objects.equals(getActions(), that.getActions()) && diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/ElasticsearchException.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/ElasticsearchException.java index 0e43d40942a7e..79f34814af0c7 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/ElasticsearchException.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/ElasticsearchException.java @@ -200,7 +200,7 @@ static String buildMessage(String type, String reason, String stack) { @Override public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof ElasticsearchException)) return false; + if ((o instanceof ElasticsearchException) == false) return false; ElasticsearchException that = (ElasticsearchException) o; return Objects.equals(getMsg(), that.getMsg()) && Objects.equals(getCause(), that.getCause()) && diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/GetTaskRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/GetTaskRequest.java index 1e49e82967792..a1aef0fc5d64c 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/GetTaskRequest.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/GetTaskRequest.java @@ -77,7 +77,7 @@ public GetTaskRequest setTimeout(TimeValue timeout) { @Override public Optional validate() { final ValidationException validationException = new ValidationException(); - if (timeout != null && !waitForCompletion) { + if (timeout != null && waitForCompletion == false) { validationException.addValidationError("Timeout settings are only accepted if waitForCompletion is also set"); } if (validationException.validationErrors().isEmpty()) { diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/ListTasksResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/ListTasksResponse.java index c6fbde9f6d1f9..9beb7870bd33d 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/ListTasksResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/ListTasksResponse.java @@ -111,7 +111,7 @@ public List getTaskGroups() { @Override public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof ListTasksResponse)) return false; + if ((o instanceof ListTasksResponse) == false) return false; ListTasksResponse response = (ListTasksResponse) o; return nodesInfoData.equals(response.nodesInfoData) && Objects.equals diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/NodeData.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/NodeData.java index 2a7388e0e595a..9f478ae614618 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/NodeData.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/NodeData.java @@ -124,7 +124,7 @@ public String toString() { @Override public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof NodeData)) return false; + if ((o instanceof NodeData) == false) return false; NodeData nodeData = (NodeData) o; return Objects.equals(getNodeId(), nodeData.getNodeId()) && Objects.equals(getName(), nodeData.getName()) && diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskGroup.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskGroup.java index 6fce60a111140..d3891e0a85852 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskGroup.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskGroup.java @@ -54,7 +54,7 @@ public static TaskGroup.Builder builder(TaskInfo taskInfo) { @Override public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof TaskGroup)) return false; + if ((o instanceof TaskGroup) == false) return false; TaskGroup taskGroup = (TaskGroup) o; return Objects.equals(task, taskGroup.task) && Objects.equals(getChildTasks(), taskGroup.getChildTasks()); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskId.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskId.java index c0dc16f92d475..8402c4de9f124 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskId.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskId.java @@ -78,7 +78,7 @@ public String toString() { @Override public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof TaskId)) return false; + if ((o instanceof TaskId) == false) return false; TaskId taskId = (TaskId) o; return getId() == taskId.getId() && Objects.equals(getNodeId(), taskId.getNodeId()); diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskInfo.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskInfo.java index c02dc880b9663..95903c2ce2546 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskInfo.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskInfo.java @@ -153,7 +153,7 @@ private void noOpParse(Object s) {} @Override public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof TaskInfo)) return false; + if ((o instanceof TaskInfo) == false) return false; TaskInfo taskInfo = (TaskInfo) o; return getStartTime() == taskInfo.getStartTime() && getRunningTimeNanos() == taskInfo.getRunningTimeNanos() && diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskOperationFailure.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskOperationFailure.java index 8aa222da04cb6..91aea2f37ed1f 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskOperationFailure.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/tasks/TaskOperationFailure.java @@ -63,7 +63,7 @@ public String getStatus() { @Override public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof TaskOperationFailure)) return false; + if ((o instanceof TaskOperationFailure) == false) return false; TaskOperationFailure that = (TaskOperationFailure) o; return getTaskId() == that.getTaskId() && Objects.equals(getNodeId(), that.getNodeId()) && diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/AckWatchRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/AckWatchRequest.java index 8c36caf9dbd5b..078c33e53ce87 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/AckWatchRequest.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/AckWatchRequest.java @@ -57,7 +57,7 @@ private void validateIds(String watchId, String... actionIds) { } } - if (!exception.validationErrors().isEmpty()) { + if (exception.validationErrors().isEmpty() == false) { throw exception; } } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/IngestRequestConvertersTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/IngestRequestConvertersTests.java index 1af55d8a93c55..67614cb70309f 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/IngestRequestConvertersTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/IngestRequestConvertersTests.java @@ -128,8 +128,9 @@ public void testSimulatePipeline() throws IOException { Request expectedRequest = IngestRequestConverters.simulatePipeline(request); StringJoiner endpoint = new StringJoiner("/", "/", ""); endpoint.add("_ingest/pipeline"); - if (pipelineId != null && !pipelineId.isEmpty()) + if (pipelineId != null && pipelineId.isEmpty() == false) { endpoint.add(pipelineId); + } endpoint.add("_simulate"); Assert.assertEquals(endpoint.toString(), expectedRequest.getEndpoint()); Assert.assertEquals(HttpPost.METHOD_NAME, expectedRequest.getMethod()); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java index d55b596965f81..8ca24f00f8917 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java @@ -1675,7 +1675,7 @@ public void testFieldCaps() throws IOException { // Verify that the resulting REST request looks as expected. StringJoiner endpoint = new StringJoiner("/", "/", ""); String joinedIndices = String.join(",", indices); - if (!joinedIndices.isEmpty()) { + if (joinedIndices.isEmpty() == false) { endpoint.add(joinedIndices); } endpoint.add("_field_caps"); @@ -1716,7 +1716,7 @@ public void testFieldCapsWithIndexFilter() throws IOException { // Verify that the resulting REST request looks as expected. StringJoiner endpoint = new StringJoiner("/", "/", ""); String joinedIndices = String.join(",", indices); - if (!joinedIndices.isEmpty()) { + if (joinedIndices.isEmpty() == false) { endpoint.add(joinedIndices); } endpoint.add("_field_caps"); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/RestHighLevelClientTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/RestHighLevelClientTests.java index a798171091a57..c94d245890601 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/RestHighLevelClientTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/RestHighLevelClientTests.java @@ -964,7 +964,7 @@ private static void assertSyncMethod(Method method, String apiName, List method.getReturnType().getSimpleName(), equalTo("boolean")); } else { // It's acceptable for 404s to be represented as empty Optionals - if (!method.getReturnType().isAssignableFrom(Optional.class)) { + if (method.getReturnType().isAssignableFrom(Optional.class) == false) { assertThat("the return type for method [" + method + "] is incorrect", method.getReturnType().getSimpleName(), endsWith("Response")); } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/ml/job/config/DetectionRuleTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/ml/job/config/DetectionRuleTests.java index 32c6ca426ca05..e6d7ca1062eb5 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/ml/job/config/DetectionRuleTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/ml/job/config/DetectionRuleTests.java @@ -46,7 +46,7 @@ protected DetectionRule createTestInstance() { boolean hasScope = randomBoolean(); boolean hasConditions = randomBoolean(); - if (!hasScope && !hasConditions) { + if (hasScope == false && hasConditions == false) { // at least one of the two should be present if (randomBoolean()) { hasScope = true; diff --git a/client/rest/src/main/java/org/elasticsearch/client/PreferHasAttributeNodeSelector.java b/client/rest/src/main/java/org/elasticsearch/client/PreferHasAttributeNodeSelector.java index e33a6936745bb..a60239a7f78a8 100644 --- a/client/rest/src/main/java/org/elasticsearch/client/PreferHasAttributeNodeSelector.java +++ b/client/rest/src/main/java/org/elasticsearch/client/PreferHasAttributeNodeSelector.java @@ -73,7 +73,7 @@ public void select(Iterable nodes) { List values = attributes.get(key); - if (values == null || !values.contains(value)) { + if (values == null || values.contains(value) == false) { nodeIterator.remove(); } } diff --git a/distribution/tools/java-version-checker/src/main/java/org/elasticsearch/tools/java_version_checker/JavaVersion.java b/distribution/tools/java-version-checker/src/main/java/org/elasticsearch/tools/java_version_checker/JavaVersion.java index 0509b27bab840..b44292b654495 100644 --- a/distribution/tools/java-version-checker/src/main/java/org/elasticsearch/tools/java_version_checker/JavaVersion.java +++ b/distribution/tools/java-version-checker/src/main/java/org/elasticsearch/tools/java_version_checker/JavaVersion.java @@ -30,7 +30,7 @@ public class JavaVersion { public static final List JAVA_11 = parse("11"); static List parse(final String value) { - if (!value.matches("^0*[0-9]+(\\.[0-9]+)*$")) { + if (value.matches("^0*[0-9]+(\\.[0-9]+)*$") == false) { throw new IllegalArgumentException(value); } diff --git a/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java b/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java index 0342b777b256a..cee583edffcdd 100644 --- a/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java +++ b/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java @@ -739,7 +739,7 @@ private Path unzip(Path zip, Path pluginsDir) throws IOException, UserException // be on the safe side: do not rely on that directories are always extracted // before their children (although this makes sense, but is it guaranteed?) - if (!Files.isSymbolicLink(targetFile.getParent())) { + if (Files.isSymbolicLink(targetFile.getParent()) == false) { Files.createDirectories(targetFile.getParent()); } if (entry.isDirectory() == false) { diff --git a/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/RemovePluginCommand.java b/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/RemovePluginCommand.java index 2e6e5537b2c57..63327566fbd78 100644 --- a/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/RemovePluginCommand.java +++ b/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/RemovePluginCommand.java @@ -136,7 +136,7 @@ void execute(Terminal terminal, Environment env, String pluginName, boolean purg final Path pluginBinDir = env.binFile().resolve(pluginName); if (Files.exists(pluginBinDir)) { - if (!Files.isDirectory(pluginBinDir)) { + if (Files.isDirectory(pluginBinDir) == false) { throw new UserException(ExitCodes.IO_ERROR, "bin dir for " + pluginName + " is not a directory"); } try (Stream paths = Files.list(pluginBinDir)) { diff --git a/libs/core/src/main/java/org/elasticsearch/bootstrap/JarHell.java b/libs/core/src/main/java/org/elasticsearch/bootstrap/JarHell.java index 91edbbc3c1f60..376f5aaaaf8e7 100644 --- a/libs/core/src/main/java/org/elasticsearch/bootstrap/JarHell.java +++ b/libs/core/src/main/java/org/elasticsearch/bootstrap/JarHell.java @@ -138,7 +138,7 @@ static Set parseClassPath(String classPath) { // Eclipse adds this to the classpath when running unit tests... continue; } - URL url = PathUtils.get(element).toUri().toURL(); + URL url = PathUtils.get(element).toUri().toURL(); // junit4.childvm.count if (urlElements.add(url) == false && element.endsWith(".jar")) { throw new IllegalStateException("jar hell!" + System.lineSeparator() + @@ -175,7 +175,7 @@ public static void checkJarHell(Set urls, Consumer output) throws U continue; } if (path.toString().endsWith(".jar")) { - if (!seenJars.add(path)) { + if (seenJars.add(path) == false) { throw new IllegalStateException("jar hell!" + System.lineSeparator() + "duplicate jar on classpath: " + path); } @@ -233,7 +233,7 @@ private static void checkManifest(Manifest manifest, Path jar) { } public static void checkVersionFormat(String targetVersion) { - if (!JavaVersion.isValid(targetVersion)) { + if (JavaVersion.isValid(targetVersion) == false) { throw new IllegalStateException( String.format( Locale.ROOT, diff --git a/libs/core/src/main/java/org/elasticsearch/bootstrap/JavaVersion.java b/libs/core/src/main/java/org/elasticsearch/bootstrap/JavaVersion.java index 1330a365d3dbd..3e73e8cb7fef1 100644 --- a/libs/core/src/main/java/org/elasticsearch/bootstrap/JavaVersion.java +++ b/libs/core/src/main/java/org/elasticsearch/bootstrap/JavaVersion.java @@ -54,7 +54,7 @@ private JavaVersion(List version, String prePart) { public static JavaVersion parse(String value) { Objects.requireNonNull(value); String prePart = null; - if (!isValid(value)) { + if (isValid(value) == false) { throw new IllegalArgumentException("Java version string [" + value + "] could not be parsed."); } List version = new ArrayList<>(); diff --git a/libs/core/src/main/java/org/elasticsearch/common/Booleans.java b/libs/core/src/main/java/org/elasticsearch/common/Booleans.java index 8687785796508..9ba065650ffeb 100644 --- a/libs/core/src/main/java/org/elasticsearch/common/Booleans.java +++ b/libs/core/src/main/java/org/elasticsearch/common/Booleans.java @@ -79,7 +79,7 @@ private static boolean hasText(CharSequence str) { } int strLen = str.length(); for (int i = 0; i < strLen; i++) { - if (!Character.isWhitespace(str.charAt(i))) { + if (Character.isWhitespace(str.charAt(i)) == false) { return true; } } @@ -128,7 +128,16 @@ public static boolean parseBooleanLenient(String value, boolean defaultValue) { if (value == null) { return defaultValue; } - return !(value.equals("false") || value.equals("0") || value.equals("off") || value.equals("no")); + switch (value) { + case "false": + case "0": + case "off": + case "no": + return false; + + default: + return true; + } } /** @@ -159,14 +168,14 @@ public static boolean parseBooleanLenient(char[] text, int offset, int length, b return text[offset] != '0'; } if (length == 2) { - return !(text[offset] == 'n' && text[offset + 1] == 'o'); + return (text[offset] == 'n' && text[offset + 1] == 'o') == false; } if (length == 3) { - return !(text[offset] == 'o' && text[offset + 1] == 'f' && text[offset + 2] == 'f'); + return (text[offset] == 'o' && text[offset + 1] == 'f' && text[offset + 2] == 'f') == false; } if (length == 5) { - return !(text[offset] == 'f' && text[offset + 1] == 'a' && text[offset + 2] == 'l' && text[offset + 3] == 's' && - text[offset + 4] == 'e'); + return (text[offset] == 'f' && text[offset + 1] == 'a' && text[offset + 2] == 'l' && text[offset + 3] == 's' && + text[offset + 4] == 'e') == false; } return true; } diff --git a/libs/core/src/main/java/org/elasticsearch/common/collect/Tuple.java b/libs/core/src/main/java/org/elasticsearch/common/collect/Tuple.java index 70c7bcbc045b6..5179cdc23bb95 100644 --- a/libs/core/src/main/java/org/elasticsearch/common/collect/Tuple.java +++ b/libs/core/src/main/java/org/elasticsearch/common/collect/Tuple.java @@ -48,8 +48,8 @@ public boolean equals(Object o) { Tuple tuple = (Tuple) o; - if (v1 != null ? !v1.equals(tuple.v1) : tuple.v1 != null) return false; - if (v2 != null ? !v2.equals(tuple.v2) : tuple.v2 != null) return false; + if (v1 != null ? v1.equals(tuple.v1) == false : tuple.v1 != null) return false; + if (v2 != null ? v2.equals(tuple.v2) == false : tuple.v2 != null) return false; return true; } diff --git a/libs/core/src/main/java/org/elasticsearch/core/internal/io/IOUtils.java b/libs/core/src/main/java/org/elasticsearch/core/internal/io/IOUtils.java index 946c8f43e9ee4..2546d661fd01b 100644 --- a/libs/core/src/main/java/org/elasticsearch/core/internal/io/IOUtils.java +++ b/libs/core/src/main/java/org/elasticsearch/core/internal/io/IOUtils.java @@ -200,7 +200,7 @@ public static void deleteFilesIgnoringExceptions(final Collection unremoved = rm(new LinkedHashMap<>(), locations); - if (!unremoved.isEmpty()) { + if (unremoved.isEmpty() == false) { final StringBuilder b = new StringBuilder("could not remove the following files (in the order of attempts):\n"); for (final Map.Entry kv : unremoved.entrySet()) { b.append(" ") diff --git a/libs/dissect/src/main/java/org/elasticsearch/dissect/DissectKey.java b/libs/dissect/src/main/java/org/elasticsearch/dissect/DissectKey.java index 67a6842182da7..5459850c521f0 100644 --- a/libs/dissect/src/main/java/org/elasticsearch/dissect/DissectKey.java +++ b/libs/dissect/src/main/java/org/elasticsearch/dissect/DissectKey.java @@ -174,13 +174,13 @@ static Modifier fromString(String modifier) { private static Modifier findModifier(String key) { Modifier modifier = Modifier.NONE; - if (key != null && !key.isEmpty()) { + if (key != null && key.isEmpty() == false) { Matcher matcher = MODIFIER_PATTERN.matcher(key); int matches = 0; while (matcher.find()) { Modifier priorModifier = modifier; modifier = Modifier.fromString(matcher.group()); - if (++matches > 1 && !(APPEND.equals(priorModifier) && APPEND_WITH_ORDER.equals(modifier))) { + if (++matches > 1 && (APPEND.equals(priorModifier) && APPEND_WITH_ORDER.equals(modifier)) == false) { throw new DissectException.KeyParse(key, "multiple modifiers are not allowed."); } } diff --git a/libs/dissect/src/main/java/org/elasticsearch/dissect/DissectParser.java b/libs/dissect/src/main/java/org/elasticsearch/dissect/DissectParser.java index 66edf0646882e..9db4b5cd3cc89 100644 --- a/libs/dissect/src/main/java/org/elasticsearch/dissect/DissectParser.java +++ b/libs/dissect/src/main/java/org/elasticsearch/dissect/DissectParser.java @@ -240,9 +240,9 @@ public Map parse(String inputString) { if (lookAheadMatches == delimiter.length) { //jump to the end of the match i += lookAheadMatches; - if (!key.skipRightPadding()) { + if (key.skipRightPadding() == false) { //progress the keys/delimiter if possible - if (!it.hasNext()) { + if (it.hasNext() == false) { break; //the while loop } dissectPair = it.next(); @@ -255,7 +255,7 @@ public Map parse(String inputString) { } } //progress the keys/delimiter if possible - if (!it.hasNext()) { + if (it.hasNext() == false) { break; //the for loop } dissectPair = it.next(); @@ -268,7 +268,7 @@ public Map parse(String inputString) { } //the last key, grab the rest of the input (unless consecutive delimiters already grabbed the last key) //and there is no trailing delimiter - if (!dissectMatch.fullyMatched() && delimiter.length == 0 ) { + if (dissectMatch.fullyMatched() == false && delimiter.length == 0 ) { byte[] value = Arrays.copyOfRange(input, valueStart, input.length); String valueString = new String(value, StandardCharsets.UTF_8); dissectMatch.add(key, valueString); @@ -276,7 +276,7 @@ public Map parse(String inputString) { } Map results = dissectMatch.getResults(); - if (!dissectMatch.isValid(results)) { + if (dissectMatch.isValid(results) == false) { throw new DissectException.FindMatch(pattern, inputString); } return results; diff --git a/libs/dissect/src/test/java/org/elasticsearch/dissect/DissectParserTests.java b/libs/dissect/src/test/java/org/elasticsearch/dissect/DissectParserTests.java index c604b8c089b84..731a387d801e0 100644 --- a/libs/dissect/src/test/java/org/elasticsearch/dissect/DissectParserTests.java +++ b/libs/dissect/src/test/java/org/elasticsearch/dissect/DissectParserTests.java @@ -321,7 +321,7 @@ public void testJsonSpecification() throws Exception { while (tests.hasNext()) { JsonNode test = tests.next(); boolean skip = test.path("skip").asBoolean(); - if (!skip) { + if (skip == false) { String name = test.path("name").asText(); logger.debug("Running Json specification: " + name); String pattern = test.path("tok").asText(); diff --git a/libs/geo/src/main/java/org/elasticsearch/geometry/utils/WellKnownText.java b/libs/geo/src/main/java/org/elasticsearch/geometry/utils/WellKnownText.java index 4efdc0aca8f66..1edf9e22faa9b 100644 --- a/libs/geo/src/main/java/org/elasticsearch/geometry/utils/WellKnownText.java +++ b/libs/geo/src/main/java/org/elasticsearch/geometry/utils/WellKnownText.java @@ -433,7 +433,7 @@ private Polygon parsePolygon(StreamTokenizer stream) throws IOException, ParseEx private void closeLinearRingIfCoerced(ArrayList lats, ArrayList lons, ArrayList alts) { if (coerce && lats.isEmpty() == false && lons.isEmpty() == false) { int last = lats.size() - 1; - if (!lats.get(0).equals(lats.get(last)) || !lons.get(0).equals(lons.get(last)) || + if (lats.get(0).equals(lats.get(last)) == false || lons.get(0).equals(lons.get(last)) == false || (alts.isEmpty() == false && !alts.get(0).equals(alts.get(last)))) { lons.add(lons.get(0)); lats.add(lats.get(0)); diff --git a/libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/DerParser.java b/libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/DerParser.java index 827548813f558..dd4f92f21920f 100644 --- a/libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/DerParser.java +++ b/libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/DerParser.java @@ -194,8 +194,9 @@ public boolean isConstructed() { * @return A parser for the construct. */ public DerParser getParser() throws IOException { - if (!isConstructed()) + if (isConstructed() == false) { throw new IOException("Invalid DER: can't parse primitive entity"); //$NON-NLS-1$ + } return new DerParser(value); } diff --git a/libs/x-content/src/main/java/org/elasticsearch/common/xcontent/support/AbstractXContentParser.java b/libs/x-content/src/main/java/org/elasticsearch/common/xcontent/support/AbstractXContentParser.java index e1f2baf66ca70..13dc8e9ba81bf 100644 --- a/libs/x-content/src/main/java/org/elasticsearch/common/xcontent/support/AbstractXContentParser.java +++ b/libs/x-content/src/main/java/org/elasticsearch/common/xcontent/support/AbstractXContentParser.java @@ -48,7 +48,7 @@ public abstract class AbstractXContentParser implements XContentParser { public static final boolean DEFAULT_NUMBER_COERCE_POLICY = true; private static void checkCoerceString(boolean coerce, Class clazz) { - if (!coerce) { + if (coerce == false) { //Need to throw type IllegalArgumentException as current catch logic in //NumberFieldMapper.parseCreateField relies on this for "malformed" value detection throw new IllegalArgumentException(clazz.getSimpleName() + " value passed as String"); @@ -68,7 +68,7 @@ public AbstractXContentParser(NamedXContentRegistry xContentRegistry, Deprecatio // If this behaviour is flagged as undesirable and any truncation occurs // then this method is called to trigger the"malformed" handling logic void ensureNumberConversion(boolean coerce, long result, Class clazz) throws IOException { - if (!coerce) { + if (coerce == false) { double fullVal = doDoubleValue(); if (result != fullVal) { // Need to throw type IllegalArgumentException as current catch diff --git a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregator.java b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregator.java index 1a75bc225c991..1a511bb638afe 100644 --- a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregator.java +++ b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregator.java @@ -49,7 +49,7 @@ final class MatrixStatsAggregator extends MetricsAggregator { MatrixStatsAggregator(String name, Map valuesSources, AggregationContext context, Aggregator parent, MultiValueMode multiValueMode, Map metadata) throws IOException { super(name, context, parent, metadata); - if (valuesSources != null && !valuesSources.isEmpty()) { + if (valuesSources != null && valuesSources.isEmpty() == false) { this.valuesSources = new NumericArrayValuesSource(valuesSources, multiValueMode); stats = context.bigArrays().newObjectArray(1); } else { diff --git a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceParser.java b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceParser.java index 7d1a83e91dd58..83ed85e8d1362 100644 --- a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceParser.java +++ b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/ArrayValuesSourceParser.java @@ -88,7 +88,7 @@ public final ArrayValuesSourceAggregationBuilder parse(String aggregationName throw new ParsingException(parser.getTokenLocation(), "Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]. " + "Multi-field aggregations do not support scripts."); - } else if (!token(aggregationName, currentFieldName, token, parser, otherOptions)) { + } else if (token(aggregationName, currentFieldName, token, parser, otherOptions) == false) { throw new ParsingException(parser.getTokenLocation(), "Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]."); } @@ -103,7 +103,7 @@ public final ArrayValuesSourceAggregationBuilder parse(String aggregationName "Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]. " + "Multi-field aggregations do not support scripts."); - } else if (!token(aggregationName, currentFieldName, token, parser, otherOptions)) { + } else if (token(aggregationName, currentFieldName, token, parser, otherOptions) == false) { throw new ParsingException(parser.getTokenLocation(), "Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]."); } @@ -122,11 +122,11 @@ public final ArrayValuesSourceAggregationBuilder parse(String aggregationName "Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]."); } } - } else if (!token(aggregationName, currentFieldName, token, parser, otherOptions)) { + } else if (token(aggregationName, currentFieldName, token, parser, otherOptions) == false) { throw new ParsingException(parser.getTokenLocation(), "Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]."); } - } else if (!token(aggregationName, currentFieldName, token, parser, otherOptions)) { + } else if (token(aggregationName, currentFieldName, token, parser, otherOptions) == false) { throw new ParsingException(parser.getTokenLocation(), "Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]."); } diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/MappingCharFilterFactory.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/MappingCharFilterFactory.java index c2b361428efe4..dfd9f7f138f59 100644 --- a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/MappingCharFilterFactory.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/MappingCharFilterFactory.java @@ -64,8 +64,9 @@ public Reader create(Reader tokenStream) { private void parseRules(List rules, NormalizeCharMap.Builder map) { for (String rule : rules) { Matcher m = rulePattern.matcher(rule); - if (!m.find()) + if (m.find() == false) { throw new RuntimeException("Invalid Mapping Rule : [" + rule + "]"); + } String lhs = parseString(m.group(1).trim()); String rhs = parseString(m.group(2).trim()); if (lhs == null || rhs == null) diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/NGramTokenizerFactory.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/NGramTokenizerFactory.java index 86327a0cc1c49..5d751693b49f6 100644 --- a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/NGramTokenizerFactory.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/NGramTokenizerFactory.java @@ -57,7 +57,7 @@ public class NGramTokenizerFactory extends AbstractTokenizerFactory { matchers.put("symbol", CharMatcher.Basic.SYMBOL); // Populate with unicode categories from java.lang.Character for (Field field : Character.class.getFields()) { - if (!field.getName().startsWith("DIRECTIONALITY") + if (field.getName().startsWith("DIRECTIONALITY") == false && Modifier.isPublic(field.getModifiers()) && Modifier.isStatic(field.getModifiers()) && field.getType() == byte.class) { diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/PatternReplaceCharFilterFactory.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/PatternReplaceCharFilterFactory.java index a9708f0beda82..7b0f03e0bf7ab 100644 --- a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/PatternReplaceCharFilterFactory.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/PatternReplaceCharFilterFactory.java @@ -39,7 +39,7 @@ public class PatternReplaceCharFilterFactory extends AbstractCharFilterFactory i super(indexSettings, name); String sPattern = settings.get("pattern"); - if (!Strings.hasLength(sPattern)) { + if (Strings.hasLength(sPattern) == false) { throw new IllegalArgumentException("pattern is missing for [" + name + "] char filter of type 'pattern_replace'"); } pattern = Regex.compile(sPattern, settings.get("flags")); diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/UniqueTokenFilter.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/UniqueTokenFilter.java index ae2b03f532976..a748369662f50 100644 --- a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/UniqueTokenFilter.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/UniqueTokenFilter.java @@ -71,7 +71,7 @@ public final boolean incrementToken() throws IOException { System.arraycopy(term, 0, saved, 0, length); previous.add(saved); - if (!duplicate) { + if (duplicate == false) { return true; } } diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/WordDelimiterTokenFilterFactory.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/WordDelimiterTokenFilterFactory.java index 97ccef9225586..6f22e1aec1cff 100644 --- a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/WordDelimiterTokenFilterFactory.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/WordDelimiterTokenFilterFactory.java @@ -138,8 +138,9 @@ static byte[] parseTypes(Collection rules) { SortedMap typeMap = new TreeMap<>(); for (String rule : rules) { Matcher m = typePattern.matcher(rule); - if (!m.find()) + if (m.find() == false) { throw new RuntimeException("Invalid Mapping Rule : [" + rule + "]"); + } String lhs = parseString(m.group(1).trim()); Byte rhs = parseType(m.group(2).trim()); if (lhs.length() != 1) diff --git a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/ConvertProcessor.java b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/ConvertProcessor.java index 623aab05f3aaf..0ac8496c83577 100644 --- a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/ConvertProcessor.java +++ b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/ConvertProcessor.java @@ -102,7 +102,7 @@ public Object convert(Object value) { }, AUTO { @Override public Object convert(Object value) { - if (!(value instanceof String)) { + if ((value instanceof String) == false) { return value; } try { diff --git a/modules/ingest-user-agent/src/main/java/org/elasticsearch/ingest/useragent/UserAgentParser.java b/modules/ingest-user-agent/src/main/java/org/elasticsearch/ingest/useragent/UserAgentParser.java index f8aec041d742a..a2d388f231dc9 100644 --- a/modules/ingest-user-agent/src/main/java/org/elasticsearch/ingest/useragent/UserAgentParser.java +++ b/modules/ingest-user-agent/src/main/java/org/elasticsearch/ingest/useragent/UserAgentParser.java @@ -238,7 +238,7 @@ public VersionedName match(String agentString) { String name = null, major = null, minor = null, patch = null, build = null; Matcher matcher = pattern.matcher(agentString); - if (!matcher.find()) { + if (matcher.find() == false) { return null; } diff --git a/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/DateMethodValueSource.java b/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/DateMethodValueSource.java index f1c918e2d2447..d4b222fead1e5 100644 --- a/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/DateMethodValueSource.java +++ b/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/DateMethodValueSource.java @@ -75,7 +75,7 @@ public String toString() { public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; + if (super.equals(o) == false) return false; DateMethodValueSource that = (DateMethodValueSource) o; diff --git a/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/DateObjectValueSource.java b/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/DateObjectValueSource.java index 2c027a060b9a3..0f2d5115ea1c4 100644 --- a/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/DateObjectValueSource.java +++ b/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/DateObjectValueSource.java @@ -77,7 +77,7 @@ public String toString() { public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; + if (super.equals(o) == false) return false; DateObjectValueSource that = (DateObjectValueSource) o; return methodName.equals(that.methodName); diff --git a/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/ExpressionScriptEngine.java b/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/ExpressionScriptEngine.java index 18d73e79509c1..04ed7298b56b9 100644 --- a/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/ExpressionScriptEngine.java +++ b/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/ExpressionScriptEngine.java @@ -450,7 +450,7 @@ private static DoubleValuesSource getDocValueSource(String variable, SearchLooku dateAccessor = true; } } - if (!dateAccessor) { + if (dateAccessor == false) { throw new IllegalArgumentException( "Variable [" + variable + "] does not follow an allowed format of either doc['field'] or doc['field'].method()" ); diff --git a/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/FieldDataValueSource.java b/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/FieldDataValueSource.java index 7ab8c3dd8f8bd..65ef419b65851 100644 --- a/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/FieldDataValueSource.java +++ b/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/FieldDataValueSource.java @@ -49,7 +49,7 @@ public boolean equals(Object o) { FieldDataValueSource that = (FieldDataValueSource) o; - if (!fieldData.equals(that.fieldData)) return false; + if (fieldData.equals(that.fieldData) == false) return false; return multiValueMode == that.multiValueMode; } diff --git a/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/GeoLongitudeValueSource.java b/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/GeoLongitudeValueSource.java index 85bb6d4a31134..ad79fb939decf 100644 --- a/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/GeoLongitudeValueSource.java +++ b/modules/lang-expression/src/main/java/org/elasticsearch/script/expression/GeoLongitudeValueSource.java @@ -64,7 +64,7 @@ public boolean equals(Object obj) { if (obj == null) return false; if (getClass() != obj.getClass()) return false; GeoLongitudeValueSource other = (GeoLongitudeValueSource) obj; - if (!fieldData.equals(other.fieldData)) return false; + if (fieldData.equals(other.fieldData) == false) return false; return true; } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/Def.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/Def.java index a473d1e5d19a3..f877a7a4c1617 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/Def.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/Def.java @@ -93,7 +93,7 @@ private static final class ArrayLengthHelper { static int getArrayLength(final Object[] array) { return array.length; } static MethodHandle arrayLengthGetter(Class arrayType) { - if (!arrayType.isArray()) { + if (arrayType.isArray() == false) { throw new IllegalArgumentException("type must be an array"); } return (ARRAY_TYPE_MH_MAPPING.containsKey(arrayType)) ? @@ -622,7 +622,7 @@ static Iterator iterator(final Object[] array) { } static MethodHandle newIterator(Class arrayType) { - if (!arrayType.isArray()) { + if (arrayType.isArray() == false) { throw new IllegalArgumentException("type must be an array"); } return (ARRAY_TYPE_MH_MAPPING.containsKey(arrayType)) ? @@ -1269,7 +1269,7 @@ private static final class ArrayIndexNormalizeHelper { static int normalizeIndex(final Object[] array, final int index) { return index >= 0 ? index : index + array.length; } static MethodHandle arrayIndexNormalizer(Class arrayType) { - if (!arrayType.isArray()) { + if (arrayType.isArray() == false) { throw new IllegalArgumentException("type must be an array"); } return (ARRAY_TYPE_MH_MAPPING.containsKey(arrayType)) ? diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/MethodWriter.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/MethodWriter.java index 692d9aa065517..379ce5d9bc6ec 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/MethodWriter.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/MethodWriter.java @@ -244,7 +244,7 @@ private void writeCast(Class from, Class to) { if (from != boolean.class && from.isPrimitive() && to != boolean.class && to.isPrimitive()) { cast(getType(from), getType(to)); } else { - if (!to.isAssignableFrom(from)) { + if (to.isAssignableFrom(from) == false) { checkCast(getType(to)); } } @@ -357,7 +357,7 @@ public void writeDynamicBinaryInstruction(Location location, Class returnType // so we don't need a special NPE guard. // otherwise, we need to allow nulls for possible string concatenation. boolean hasPrimitiveArg = lhs.isPrimitive() || rhs.isPrimitive(); - if (!hasPrimitiveArg) { + if (hasPrimitiveArg == false) { flags |= DefBootstrap.OPERATOR_ALLOWS_NULL; } invokeDefCall("add", methodType, DefBootstrap.BINARY_OPERATOR, flags); @@ -466,7 +466,7 @@ public void writePop(final int size) { @Override public void endMethod() { - if (stringConcatArgs != null && !stringConcatArgs.isEmpty()) { + if (stringConcatArgs != null && stringConcatArgs.isEmpty() == false) { throw new IllegalStateException("String concat bytecode not completed."); } super.endMethod(); diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessScript.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessScript.java index 280783921d5d1..dbeecfea3a0f7 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessScript.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessScript.java @@ -89,7 +89,7 @@ default ScriptException convertToScriptException(Throwable t, Map params) { throw new IllegalArgumentException("[painless.regex.limit-factor] can only be set on node startup."); } - if (!copy.isEmpty()) { + if (copy.isEmpty() == false) { throw new IllegalArgumentException("Unrecognized compile-time parameter(s): " + copy); } } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/phase/DefaultIRTreeToASMBytesPhase.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/phase/DefaultIRTreeToASMBytesPhase.java index 71c4079b8c60f..3338d3240ef12 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/phase/DefaultIRTreeToASMBytesPhase.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/phase/DefaultIRTreeToASMBytesPhase.java @@ -1348,7 +1348,7 @@ public void visitLoadDotShortcut(LoadDotShortcutNode irDotSubShortcutNode, Write PainlessMethod getterPainlessMethod = irDotSubShortcutNode.getDecorationValue(IRDMethod.class); methodWriter.invokeMethodCall(getterPainlessMethod); - if (!getterPainlessMethod.returnType.equals(getterPainlessMethod.javaMethod.getReturnType())) { + if (getterPainlessMethod.returnType.equals(getterPainlessMethod.javaMethod.getReturnType()) == false) { methodWriter.checkCast(MethodWriter.getType(getterPainlessMethod.returnType)); } } diff --git a/modules/parent-join/src/internalClusterTest/java/org/elasticsearch/join/query/ChildQuerySearchIT.java b/modules/parent-join/src/internalClusterTest/java/org/elasticsearch/join/query/ChildQuerySearchIT.java index 26eece8fbd993..e84fa7deb7119 100644 --- a/modules/parent-join/src/internalClusterTest/java/org/elasticsearch/join/query/ChildQuerySearchIT.java +++ b/modules/parent-join/src/internalClusterTest/java/org/elasticsearch/join/query/ChildQuerySearchIT.java @@ -294,7 +294,7 @@ public void testHasParentFilter() throws Exception { String childId = "c" + i; builders.add(createIndexRequest("test", "child", childId, previousParentId, "c_field", childId)); - if (!parentToChildren.containsKey(previousParentId)) { + if (parentToChildren.containsKey(previousParentId) == false) { parentToChildren.put(previousParentId, new HashSet<>()); } assertThat(parentToChildren.get(previousParentId).add(childId), is(true)); diff --git a/modules/parent-join/src/main/java/org/elasticsearch/join/query/HasChildQueryBuilder.java b/modules/parent-join/src/main/java/org/elasticsearch/join/query/HasChildQueryBuilder.java index cbb74b3b5853c..a790f3db18158 100644 --- a/modules/parent-join/src/main/java/org/elasticsearch/join/query/HasChildQueryBuilder.java +++ b/modules/parent-join/src/main/java/org/elasticsearch/join/query/HasChildQueryBuilder.java @@ -411,9 +411,9 @@ public boolean equals(Object o) { if (minChildren != that.minChildren) return false; if (maxChildren != that.maxChildren) return false; - if (!toQuery.equals(that.toQuery)) return false; - if (!innerQuery.equals(that.innerQuery)) return false; - if (!joinField.equals(that.joinField)) return false; + if (toQuery.equals(that.toQuery) == false) return false; + if (innerQuery.equals(that.innerQuery) == false) return false; + if (joinField.equals(that.joinField) == false) return false; return scoreMode == that.scoreMode; } diff --git a/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateQueryBuilder.java b/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateQueryBuilder.java index ee5dba8cc14ba..c1b305431eace 100644 --- a/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateQueryBuilder.java +++ b/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateQueryBuilder.java @@ -529,7 +529,7 @@ protected Query doToQuery(SearchExecutionContext context) throws IOException { throw new QueryShardException(context, "field [" + field + "] does not exist"); } - if (!(fieldType instanceof PercolatorFieldMapper.PercolatorFieldType)) { + if ((fieldType instanceof PercolatorFieldMapper.PercolatorFieldType) == false) { throw new QueryShardException(context, "expected field [" + field + "] to be of type [percolator], but is of type [" + fieldType.typeName() + "]"); } diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractAsyncBulkByScrollAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractAsyncBulkByScrollAction.java index 68b0983b8f708..e3768eae1f0ee 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractAsyncBulkByScrollAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractAsyncBulkByScrollAction.java @@ -123,7 +123,7 @@ public abstract class AbstractAsyncBulkByScrollAction starting a node on ipv4 only"); diff --git a/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpRequest.java b/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpRequest.java index 7de102684817d..98aa05dd00f21 100644 --- a/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpRequest.java +++ b/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpRequest.java @@ -162,7 +162,7 @@ public List strictCookies() { String cookieString = request.headers().get(HttpHeaderNames.COOKIE); if (cookieString != null) { Set cookies = ServerCookieDecoder.STRICT.decode(cookieString); - if (!cookies.isEmpty()) { + if (cookies.isEmpty() == false) { return ServerCookieEncoder.STRICT.encode(cookies); } } diff --git a/modules/transport-netty4/src/main/java/org/elasticsearch/transport/netty4/Netty4Utils.java b/modules/transport-netty4/src/main/java/org/elasticsearch/transport/netty4/Netty4Utils.java index 939637d162ba9..c15ed5b7eb098 100644 --- a/modules/transport-netty4/src/main/java/org/elasticsearch/transport/netty4/Netty4Utils.java +++ b/modules/transport-netty4/src/main/java/org/elasticsearch/transport/netty4/Netty4Utils.java @@ -49,7 +49,7 @@ public class Netty4Utils { public static void setAvailableProcessors(final int availableProcessors) { // we set this to false in tests to avoid tests that randomly set processors from stepping on each other final boolean set = Booleans.parseBoolean(System.getProperty("es.set.netty.runtime.available.processors", "true")); - if (!set) { + if (set == false) { return; } diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpPipeliningHandlerTests.java b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpPipeliningHandlerTests.java index 26ae2cfa7e321..f9fbef9be5e13 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpPipeliningHandlerTests.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpPipeliningHandlerTests.java @@ -75,11 +75,11 @@ private CountDownLatch finishRequest(String url) { } private void shutdownExecutorService() throws InterruptedException { - if (!handlerService.isShutdown()) { + if (handlerService.isShutdown() == false) { handlerService.shutdown(); handlerService.awaitTermination(10, TimeUnit.SECONDS); } - if (!eventLoopService.isShutdown()) { + if (eventLoopService.isShutdown() == false) { eventLoopService.shutdown(); eventLoopService.awaitTermination(10, TimeUnit.SECONDS); } diff --git a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuAnalyzerProvider.java b/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuAnalyzerProvider.java index c051d32bd4a62..b7405ddf613df 100644 --- a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuAnalyzerProvider.java +++ b/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuAnalyzerProvider.java @@ -39,7 +39,7 @@ public IcuAnalyzerProvider(IndexSettings indexSettings, Environment environment, super(indexSettings, name, settings); String method = settings.get("method", "nfkc_cf"); String mode = settings.get("mode", "compose"); - if (!"compose".equals(mode) && !"decompose".equals(mode)) { + if ("compose".equals(mode) == false && "decompose".equals(mode) == false) { throw new IllegalArgumentException("Unknown mode [" + mode + "] in analyzer [" + name + "], expected one of [compose, decompose]"); } diff --git a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuNormalizerCharFilterFactory.java b/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuNormalizerCharFilterFactory.java index f27ff32b6512e..e322e8b253e62 100644 --- a/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuNormalizerCharFilterFactory.java +++ b/plugins/analysis-icu/src/main/java/org/elasticsearch/index/analysis/IcuNormalizerCharFilterFactory.java @@ -44,7 +44,7 @@ public IcuNormalizerCharFilterFactory(IndexSettings indexSettings, Environment e super(indexSettings, name); String method = settings.get("name", "nfkc_cf"); String mode = settings.get("mode"); - if (!"compose".equals(mode) && !"decompose".equals(mode)) { + if ("compose".equals(mode) == false && "decompose".equals(mode) == false) { mode = "compose"; } Normalizer2 normalizer = Normalizer2.getInstance( diff --git a/plugins/analysis-phonetic/src/main/java/org/elasticsearch/index/analysis/phonetic/KoelnerPhonetik.java b/plugins/analysis-phonetic/src/main/java/org/elasticsearch/index/analysis/phonetic/KoelnerPhonetik.java index c7b39a86a2bd7..7a6ba13c321c6 100644 --- a/plugins/analysis-phonetic/src/main/java/org/elasticsearch/index/analysis/phonetic/KoelnerPhonetik.java +++ b/plugins/analysis-phonetic/src/main/java/org/elasticsearch/index/analysis/phonetic/KoelnerPhonetik.java @@ -19,6 +19,9 @@ package org.elasticsearch.index.analysis.phonetic; +import org.apache.commons.codec.EncoderException; +import org.apache.commons.codec.StringEncoder; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -28,9 +31,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.codec.EncoderException; -import org.apache.commons.codec.StringEncoder; - /** * Kölner Phonetik * @@ -141,14 +141,14 @@ private List partition(String str) { String primaryForm = str; List parts = new ArrayList<>(); parts.add(primaryForm.replaceAll("[^\\p{L}\\p{N}]", "")); - if (!primary) { + if (primary == false) { List tmpParts = new ArrayList<>(Arrays.asList(str.split("[\\p{Z}\\p{C}\\p{P}]"))); int numberOfParts = tmpParts.size(); while (tmpParts.size() > 0) { StringBuilder part = new StringBuilder(); for (int i = 0; i < tmpParts.size(); i++) { part.append(tmpParts.get(i)); - if (!(i + 1 == numberOfParts)) { + if ((i + 1 == numberOfParts) == false) { parts.add(part.toString()); } } diff --git a/plugins/discovery-azure-classic/src/main/java/org/elasticsearch/discovery/azure/classic/AzureSeedHostsProvider.java b/plugins/discovery-azure-classic/src/main/java/org/elasticsearch/discovery/azure/classic/AzureSeedHostsProvider.java index 4c527264e23fc..4699d76eec36c 100644 --- a/plugins/discovery-azure-classic/src/main/java/org/elasticsearch/discovery/azure/classic/AzureSeedHostsProvider.java +++ b/plugins/discovery-azure-classic/src/main/java/org/elasticsearch/discovery/azure/classic/AzureSeedHostsProvider.java @@ -48,7 +48,7 @@ import java.util.List; public class AzureSeedHostsProvider implements SeedHostsProvider { - + private static final Logger logger = LogManager.getLogger(AzureSeedHostsProvider.class); public enum HostType { @@ -182,7 +182,7 @@ public List getSeedAddresses(HostsResolver hostsResolver) { } // If provided, we check the deployment name - if (Strings.hasLength(deploymentName) && !deploymentName.equals(deployment.getName())) { + if (Strings.hasLength(deploymentName) && deploymentName.equals(deployment.getName()) == false) { logger.debug("current deployment name [{}] different from [{}]. skipping...", deployment.getName(), deploymentName); continue; diff --git a/plugins/discovery-ec2/src/main/java/org/elasticsearch/discovery/ec2/AwsEc2SeedHostsProvider.java b/plugins/discovery-ec2/src/main/java/org/elasticsearch/discovery/ec2/AwsEc2SeedHostsProvider.java index dd4ef02c0b318..87e60af7788ed 100644 --- a/plugins/discovery-ec2/src/main/java/org/elasticsearch/discovery/ec2/AwsEc2SeedHostsProvider.java +++ b/plugins/discovery-ec2/src/main/java/org/elasticsearch/discovery/ec2/AwsEc2SeedHostsProvider.java @@ -121,7 +121,7 @@ protected List fetchDynamicNodes() { for (final Reservation reservation : descInstances.getReservations()) { for (final Instance instance : reservation.getInstances()) { // lets see if we can filter based on groups - if (!groups.isEmpty()) { + if (groups.isEmpty() == false) { final List instanceSecurityGroups = instance.getSecurityGroups(); final List securityGroupNames = new ArrayList<>(instanceSecurityGroups.size()); final List securityGroupIds = new ArrayList<>(instanceSecurityGroups.size()); @@ -140,7 +140,7 @@ && disjoint(securityGroupIds, groups)) { } } else { // We need tp match all group names or group ids, otherwise we ignore this instance - if (!(securityGroupNames.containsAll(groups) || securityGroupIds.containsAll(groups))) { + if ((securityGroupNames.containsAll(groups) || securityGroupIds.containsAll(groups)) == false) { logger.trace("filtering out instance {} based on groups {}, does not include all of {}", instance.getInstanceId(), instanceSecurityGroups, groups); // continue to the next instance @@ -209,7 +209,7 @@ private DescribeInstancesRequest buildDescribeInstancesRequest() { ); } - if (!availabilityZones.isEmpty()) { + if (availabilityZones.isEmpty() == false) { // OR relationship amongst multiple values of the availability-zone filter describeInstancesRequest.withFilters( new Filter("availability-zone").withValues(availabilityZones) diff --git a/plugins/discovery-gce/src/main/java/org/elasticsearch/discovery/gce/GceSeedHostsProvider.java b/plugins/discovery-gce/src/main/java/org/elasticsearch/discovery/gce/GceSeedHostsProvider.java index d193cb25c6e31..aff27a0441cd1 100644 --- a/plugins/discovery-gce/src/main/java/org/elasticsearch/discovery/gce/GceSeedHostsProvider.java +++ b/plugins/discovery-gce/src/main/java/org/elasticsearch/discovery/gce/GceSeedHostsProvider.java @@ -49,7 +49,7 @@ import static java.util.Collections.emptyList; public class GceSeedHostsProvider implements SeedHostsProvider { - + private static final Logger logger = LogManager.getLogger(GceSeedHostsProvider.class); /** @@ -171,7 +171,7 @@ public List getSeedAddresses(HostsResolver hostsResolver) { break; } } - if (!found) { + if (found == false) { filterByTag = true; break; } diff --git a/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureBlobContainer.java b/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureBlobContainer.java index 7227595054955..b7683c19ad3a6 100644 --- a/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureBlobContainer.java +++ b/plugins/repository-azure/src/main/java/org/elasticsearch/repositories/azure/AzureBlobContainer.java @@ -58,7 +58,7 @@ public boolean blobExists(String blobName) throws IOException { private InputStream openInputStream(String blobName, long position, @Nullable Long length) throws IOException { logger.trace("readBlob({}) from position [{}] with length [{}]", blobName, position, length != null ? length : "unlimited"); - if (blobStore.getLocationMode() == LocationMode.SECONDARY_ONLY && !blobExists(blobName)) { + if (blobStore.getLocationMode() == LocationMode.SECONDARY_ONLY && blobExists(blobName) == false) { // On Azure, if the location path is a secondary location, and the blob does not // exist, instead of returning immediately from the getInputStream call below // with a 404 StorageException, Azure keeps trying and trying for a long timeout diff --git a/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageHttpStatsCollector.java b/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageHttpStatsCollector.java index 8844e18c0c797..9c1991fe77bb5 100644 --- a/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageHttpStatsCollector.java +++ b/plugins/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageHttpStatsCollector.java @@ -64,7 +64,7 @@ final class GoogleCloudStorageHttpStatsCollector implements HttpResponseIntercep @Override public void interceptResponse(final HttpResponse response) { // TODO keep track of unsuccessful requests in different entries - if (!response.isSuccessStatusCode()) + if (response.isSuccessStatusCode() == false) return; final HttpRequest request = response.getRequest(); diff --git a/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsBlobStore.java b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsBlobStore.java index ad0e663058554..1094927b1a469 100644 --- a/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsBlobStore.java +++ b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsBlobStore.java @@ -50,7 +50,7 @@ final class HdfsBlobStore implements BlobStore { this.bufferSize = bufferSize; this.root = execute(fileContext1 -> fileContext1.makeQualified(new Path(path))); this.readOnly = readOnly; - if (!readOnly) { + if (readOnly == false) { try { mkdirs(root); } catch (FileAlreadyExistsException ok) { @@ -78,7 +78,7 @@ public BlobContainer blobContainer(BlobPath path) { private Path buildHdfsPath(BlobPath blobPath) { final Path path = translateToHdfsPath(blobPath); - if (!readOnly) { + if (readOnly == false) { try { mkdirs(path); } catch (FileAlreadyExistsException ok) { diff --git a/plugins/transport-nio/src/main/java/org/elasticsearch/http/nio/NioHttpRequest.java b/plugins/transport-nio/src/main/java/org/elasticsearch/http/nio/NioHttpRequest.java index 9ff079ffe72f7..0650fb6318984 100644 --- a/plugins/transport-nio/src/main/java/org/elasticsearch/http/nio/NioHttpRequest.java +++ b/plugins/transport-nio/src/main/java/org/elasticsearch/http/nio/NioHttpRequest.java @@ -161,7 +161,7 @@ public List strictCookies() { String cookieString = request.headers().get(HttpHeaderNames.COOKIE); if (cookieString != null) { Set cookies = ServerCookieDecoder.STRICT.decode(cookieString); - if (!cookies.isEmpty()) { + if (cookies.isEmpty() == false) { return ServerCookieEncoder.STRICT.encode(cookies); } } diff --git a/plugins/transport-nio/src/test/java/org/elasticsearch/http/nio/NioHttpPipeliningHandlerTests.java b/plugins/transport-nio/src/test/java/org/elasticsearch/http/nio/NioHttpPipeliningHandlerTests.java index 5ae0851c6b839..4121610c768d5 100644 --- a/plugins/transport-nio/src/test/java/org/elasticsearch/http/nio/NioHttpPipeliningHandlerTests.java +++ b/plugins/transport-nio/src/test/java/org/elasticsearch/http/nio/NioHttpPipeliningHandlerTests.java @@ -75,11 +75,11 @@ private CountDownLatch finishRequest(String url) { } private void shutdownExecutorService() throws InterruptedException { - if (!handlerService.isShutdown()) { + if (handlerService.isShutdown() == false) { handlerService.shutdown(); handlerService.awaitTermination(10, TimeUnit.SECONDS); } - if (!eventLoopService.isShutdown()) { + if (eventLoopService.isShutdown() == false) { eventLoopService.shutdown(); eventLoopService.awaitTermination(10, TimeUnit.SECONDS); } diff --git a/qa/evil-tests/src/test/java/org/elasticsearch/bootstrap/SystemCallFilterTests.java b/qa/evil-tests/src/test/java/org/elasticsearch/bootstrap/SystemCallFilterTests.java index 244f98356d976..cba4b05d1672e 100644 --- a/qa/evil-tests/src/test/java/org/elasticsearch/bootstrap/SystemCallFilterTests.java +++ b/qa/evil-tests/src/test/java/org/elasticsearch/bootstrap/SystemCallFilterTests.java @@ -37,7 +37,7 @@ public void setUp() throws Exception { // otherwise, since we don't have TSYNC support, rules are not applied to the test thread // (randomizedrunner class initialization happens in its own thread, after the test thread is created) // instead we just forcefully run it for the test thread here. - if (!JNANatives.LOCAL_SYSTEM_CALL_FILTER_ALL) { + if (JNANatives.LOCAL_SYSTEM_CALL_FILTER_ALL == false) { try { SystemCallFilter.init(createTempDir()); } catch (Exception e) { diff --git a/test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/search/aggregations/DelayedShardAggregationBuilder.java b/test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/search/aggregations/DelayedShardAggregationBuilder.java index 76965d06bf886..fe9d127446687 100644 --- a/test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/search/aggregations/DelayedShardAggregationBuilder.java +++ b/test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/search/aggregations/DelayedShardAggregationBuilder.java @@ -126,7 +126,7 @@ protected Aggregator createInternal(Aggregator parent, CardinalityUpperBound car public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; + if (super.equals(o) == false) return false; DelayedShardAggregationBuilder that = (DelayedShardAggregationBuilder) o; return Objects.equals(delay, that.delay); } diff --git a/test/framework/src/main/java/org/elasticsearch/common/util/MockBigArrays.java b/test/framework/src/main/java/org/elasticsearch/common/util/MockBigArrays.java index 0e846b9f95c84..7cbdc91b8116d 100644 --- a/test/framework/src/main/java/org/elasticsearch/common/util/MockBigArrays.java +++ b/test/framework/src/main/java/org/elasticsearch/common/util/MockBigArrays.java @@ -101,7 +101,7 @@ public static void assertFitsIn(ByteSizeValue max, Function masterCopy = new HashMap<>(ACQUIRED_ARRAYS); - if (!masterCopy.isEmpty()) { + if (masterCopy.isEmpty() == false) { // not empty, we might be executing on a shared cluster that keeps on obtaining // and releasing arrays, lets make sure that after a reasonable timeout, all master // copy (snapshot) have been released @@ -110,7 +110,7 @@ public static void ensureAllArraysAreReleased() throws Exception { } catch (AssertionError ex) { masterCopy.keySet().retainAll(ACQUIRED_ARRAYS.keySet()); ACQUIRED_ARRAYS.keySet().removeAll(masterCopy.keySet()); // remove all existing master copy we will report on - if (!masterCopy.isEmpty()) { + if (masterCopy.isEmpty() == false) { Iterator causes = masterCopy.values().iterator(); Object firstCause = causes.next(); RuntimeException exception = new RuntimeException(masterCopy.size() + " arrays have not been released", @@ -170,7 +170,7 @@ public BigArrays withCircuitBreaking() { @Override public ByteArray newByteArray(long size, boolean clearOnResize) { final ByteArrayWrapper array = new ByteArrayWrapper(super.newByteArray(size, clearOnResize), clearOnResize); - if (!clearOnResize) { + if (clearOnResize == false) { array.randomizeContent(0, size); } return array; @@ -187,7 +187,7 @@ public ByteArray resize(ByteArray array, long size) { } else { arr = new ByteArrayWrapper(array, arr.clearOnResize); } - if (!arr.clearOnResize) { + if (arr.clearOnResize == false) { arr.randomizeContent(originalSize, size); } return arr; @@ -196,7 +196,7 @@ public ByteArray resize(ByteArray array, long size) { @Override public IntArray newIntArray(long size, boolean clearOnResize) { final IntArrayWrapper array = new IntArrayWrapper(super.newIntArray(size, clearOnResize), clearOnResize); - if (!clearOnResize) { + if (clearOnResize == false) { array.randomizeContent(0, size); } return array; @@ -213,7 +213,7 @@ public IntArray resize(IntArray array, long size) { } else { arr = new IntArrayWrapper(array, arr.clearOnResize); } - if (!arr.clearOnResize) { + if (arr.clearOnResize == false) { arr.randomizeContent(originalSize, size); } return arr; @@ -222,7 +222,7 @@ public IntArray resize(IntArray array, long size) { @Override public LongArray newLongArray(long size, boolean clearOnResize) { final LongArrayWrapper array = new LongArrayWrapper(super.newLongArray(size, clearOnResize), clearOnResize); - if (!clearOnResize) { + if (clearOnResize == false) { array.randomizeContent(0, size); } return array; @@ -239,7 +239,7 @@ public LongArray resize(LongArray array, long size) { } else { arr = new LongArrayWrapper(array, arr.clearOnResize); } - if (!arr.clearOnResize) { + if (arr.clearOnResize == false) { arr.randomizeContent(originalSize, size); } return arr; @@ -248,7 +248,7 @@ public LongArray resize(LongArray array, long size) { @Override public FloatArray newFloatArray(long size, boolean clearOnResize) { final FloatArrayWrapper array = new FloatArrayWrapper(super.newFloatArray(size, clearOnResize), clearOnResize); - if (!clearOnResize) { + if (clearOnResize == false) { array.randomizeContent(0, size); } return array; @@ -265,7 +265,7 @@ public FloatArray resize(FloatArray array, long size) { } else { arr = new FloatArrayWrapper(array, arr.clearOnResize); } - if (!arr.clearOnResize) { + if (arr.clearOnResize == false) { arr.randomizeContent(originalSize, size); } return arr; @@ -274,7 +274,7 @@ public FloatArray resize(FloatArray array, long size) { @Override public DoubleArray newDoubleArray(long size, boolean clearOnResize) { final DoubleArrayWrapper array = new DoubleArrayWrapper(super.newDoubleArray(size, clearOnResize), clearOnResize); - if (!clearOnResize) { + if (clearOnResize == false) { array.randomizeContent(0, size); } return array; @@ -291,7 +291,7 @@ public DoubleArray resize(DoubleArray array, long size) { } else { arr = new DoubleArrayWrapper(array, arr.clearOnResize); } - if (!arr.clearOnResize) { + if (arr.clearOnResize == false) { arr.randomizeContent(originalSize, size); } return arr; diff --git a/test/framework/src/main/java/org/elasticsearch/common/util/MockPageCacheRecycler.java b/test/framework/src/main/java/org/elasticsearch/common/util/MockPageCacheRecycler.java index 1bb432360313a..0e30a67962aef 100644 --- a/test/framework/src/main/java/org/elasticsearch/common/util/MockPageCacheRecycler.java +++ b/test/framework/src/main/java/org/elasticsearch/common/util/MockPageCacheRecycler.java @@ -41,16 +41,16 @@ public class MockPageCacheRecycler extends PageCacheRecycler { public static void ensureAllPagesAreReleased() throws Exception { final Map masterCopy = new HashMap<>(ACQUIRED_PAGES); - if (!masterCopy.isEmpty()) { + if (masterCopy.isEmpty() == false) { // not empty, we might be executing on a shared cluster that keeps on obtaining // and releasing pages, lets make sure that after a reasonable timeout, all master // copy (snapshot) have been released final boolean success = waitUntil(() -> Sets.haveEmptyIntersection(masterCopy.keySet(), ACQUIRED_PAGES.keySet())); - if (!success) { + if (success == false) { masterCopy.keySet().retainAll(ACQUIRED_PAGES.keySet()); ACQUIRED_PAGES.keySet().removeAll(masterCopy.keySet()); // remove all existing master copy we will report on - if (!masterCopy.isEmpty()) { + if (masterCopy.isEmpty() == false) { Iterator causes = masterCopy.values().iterator(); Throwable firstCause = causes.next(); RuntimeException exception = new RuntimeException(masterCopy.size() + " pages have not been released", firstCause); @@ -120,7 +120,7 @@ public boolean isRecycled() { @Override public V bytePage(boolean clear) { final V page = super.bytePage(clear); - if (!clear) { + if (clear == false) { Arrays.fill(page.v(), 0, page.v().length, (byte)random.nextInt(1<<8)); } return wrap(page); @@ -129,7 +129,7 @@ public V bytePage(boolean clear) { @Override public V intPage(boolean clear) { final V page = super.intPage(clear); - if (!clear) { + if (clear == false) { Arrays.fill(page.v(), 0, page.v().length, random.nextInt()); } return wrap(page); @@ -138,7 +138,7 @@ public V intPage(boolean clear) { @Override public V longPage(boolean clear) { final V page = super.longPage(clear); - if (!clear) { + if (clear == false) { Arrays.fill(page.v(), 0, page.v().length, random.nextLong()); } return wrap(page); diff --git a/test/framework/src/main/java/org/elasticsearch/test/BackgroundIndexer.java b/test/framework/src/main/java/org/elasticsearch/test/BackgroundIndexer.java index 3bedd105edc05..2543b93b3643b 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/BackgroundIndexer.java +++ b/test/framework/src/main/java/org/elasticsearch/test/BackgroundIndexer.java @@ -134,13 +134,13 @@ public void run() { try { startLatch.await(); logger.info("**** starting indexing thread {}", indexerId); - while (!stop.get()) { + while (stop.get() == false) { if (batch) { int batchSize = threadRandom.nextInt(20) + 1; if (hasBudget.get()) { // always try to get at least one batchSize = Math.max(Math.min(batchSize, availableBudget.availablePermits()), 1); - if (!availableBudget.tryAcquire(batchSize, 250, TimeUnit.MILLISECONDS)) { + if (availableBudget.tryAcquire(batchSize, 250, TimeUnit.MILLISECONDS) == false) { // time out -> check if we have to stop. continue; } @@ -173,7 +173,7 @@ public void run() { } } else { - if (hasBudget.get() && !availableBudget.tryAcquire(250, TimeUnit.MILLISECONDS)) { + if (hasBudget.get() && availableBudget.tryAcquire(250, TimeUnit.MILLISECONDS) == false) { // time out -> check if we have to stop. continue; } @@ -278,7 +278,7 @@ private void setBudget(int numOfDocs) { * @param numOfDocs number of document to index before pausing. Set to -1 to have no limit. */ public void start(int numOfDocs) { - assert !stop.get() : "background indexer can not be started after it has stopped"; + assert stop.get() == false : "background indexer can not be started after it has stopped"; setBudget(numOfDocs); startLatch.countDown(); } diff --git a/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java index 947f20e3c41c6..f1abf1aa19a2e 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java @@ -542,7 +542,7 @@ private TestCluster buildAndPutCluster(Scope currentClusterScope, long seed) thr } private static void clearClusters() throws Exception { - if (!clusters.isEmpty()) { + if (clusters.isEmpty() == false) { IOUtils.close(clusters.values()); clusters.clear(); } @@ -612,7 +612,7 @@ private void afterInternal(boolean afterClass) throws Exception { } success = true; } finally { - if (!success) { + if (success == false) { // if we failed here that means that something broke horribly so we should clear all clusters // TODO: just let the exception happen, WTF is all this horseshit // afterTestRule.forceFailure(); @@ -640,7 +640,7 @@ public static boolean isInternalCluster() { } public static InternalTestCluster internalCluster() { - if (!isInternalCluster()) { + if (isInternalCluster() == false) { throw new UnsupportedOperationException("current test cluster is immutable"); } return (InternalTestCluster) currentCluster; @@ -772,7 +772,7 @@ public final void createIndex(String... names) { created.add(name); success = true; } finally { - if (!success && !created.isEmpty()) { + if (success == false && created.isEmpty() == false) { cluster().wipeIndices(created.toArray(new String[created.size()])); } } @@ -887,7 +887,7 @@ public void allowNodes(String index, int n) { getExcludeSettings(n, builder); } Settings build = builder.build(); - if (!build.isEmpty()) { + if (build.isEmpty() == false) { logger.debug("allowNodes: updating [{}]'s setting to [{}]", index, build.toDelimitedString(';')); client().admin().indices().prepareUpdateSettings(index).setSettings(build).execute().actionGet(); } @@ -1528,7 +1528,7 @@ public void indexRandom(boolean forceRefresh, boolean dummyDocuments, boolean ma types.add(builder.request().type()); } Set> bogusIds = new HashSet<>(); // (index, type, id) - if (random.nextBoolean() && !builders.isEmpty() && dummyDocuments) { + if (random.nextBoolean() && builders.isEmpty() == false && dummyDocuments) { builders = new ArrayList<>(builders); // inject some bogus docs final int numBogusDocs = scaledRandomIntBetween(1, builders.size() * 2); @@ -1592,7 +1592,7 @@ public void indexRandom(boolean forceRefresh, boolean dummyDocuments, boolean ma } } assertThat(actualErrors, emptyIterable()); - if (!bogusIds.isEmpty()) { + if (bogusIds.isEmpty() == false) { // delete the bogus types again - it might trigger merges or at least holes in the segments and enforces deleted docs! for (List doc : bogusIds) { assertEquals("failed to delete a dummy doc [" + doc.get(0) + "][" + doc.get(2) + "]", @@ -2302,7 +2302,7 @@ private static void initializeSuiteScope() throws Exception { INSTANCE.setupSuiteScopeCluster(); success = true; } finally { - if (!success) { + if (success == false) { afterClass(); } } diff --git a/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java b/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java index 26a3f51884a34..ddd9e7262e097 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java +++ b/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java @@ -564,7 +564,7 @@ public static String clusterName(String prefix, long clusterSeed) { } private void ensureOpen() { - if (!open.get()) { + if (open.get() == false) { throw new RuntimeException("Cluster is already closed"); } } @@ -647,7 +647,7 @@ public synchronized void ensureAtMostNumDataNodes(int n) throws IOException { } stopNodesAndClients(nodesToRemove); - if (!nodesToRemove.isEmpty() && size() > 0) { + if (nodesToRemove.isEmpty() == false && size() > 0) { validateClusterFormed(); } } @@ -1586,7 +1586,7 @@ private void randomlyResetClients() { } public synchronized void wipePendingDataDirectories() { - if (!dataDirToClean.isEmpty()) { + if (dataDirToClean.isEmpty() == false) { try { for (Path path : dataDirToClean) { try { @@ -2308,7 +2308,7 @@ public String startDataOnlyNode(Settings settings) { } private synchronized void publishNode(NodeAndClient nodeAndClient) { - assert !nodeAndClient.node().isClosed(); + assert nodeAndClient.node().isClosed() == false; final NavigableMap newNodes = new TreeMap<>(nodes); newNodes.put(nodeAndClient.name, nodeAndClient); nodes = Collections.unmodifiableNavigableMap(newNodes); diff --git a/test/framework/src/main/java/org/elasticsearch/test/TestCluster.java b/test/framework/src/main/java/org/elasticsearch/test/TestCluster.java index 9bb633b2efe56..4b54ec7b10644 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/TestCluster.java +++ b/test/framework/src/main/java/org/elasticsearch/test/TestCluster.java @@ -153,7 +153,7 @@ public void wipeIndices(String... indices) { for (IndexMetadata indexMetadata : clusterStateResponse.getState().metadata()) { concreteIndices.add(indexMetadata.getIndex().getName()); } - if (!concreteIndices.isEmpty()) { + if (concreteIndices.isEmpty() == false) { assertAcked(client().admin().indices().prepareDelete(concreteIndices.toArray(String.class))); } } diff --git a/test/framework/src/main/java/org/elasticsearch/test/TestCustomMetadata.java b/test/framework/src/main/java/org/elasticsearch/test/TestCustomMetadata.java index e57e3f5e3ad75..5711429eb872e 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/TestCustomMetadata.java +++ b/test/framework/src/main/java/org/elasticsearch/test/TestCustomMetadata.java @@ -45,11 +45,15 @@ public String getData() { @Override public boolean equals(Object o) { if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (o == null || getClass() != o.getClass()) { + return false; + } TestCustomMetadata that = (TestCustomMetadata) o; - if (!data.equals(that.data)) return false; + if (data.equals(that.data) == false) { + return false; + } return true; } diff --git a/test/framework/src/main/java/org/elasticsearch/test/disruption/IntermittentLongGCDisruption.java b/test/framework/src/main/java/org/elasticsearch/test/disruption/IntermittentLongGCDisruption.java index b6ee8f1831cb2..e2b7d9d06f0cb 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/disruption/IntermittentLongGCDisruption.java +++ b/test/framework/src/main/java/org/elasticsearch/test/disruption/IntermittentLongGCDisruption.java @@ -79,7 +79,7 @@ private void simulateLongGC(final TimeValue duration) throws InterruptedExceptio final Set nodeThreads = new HashSet<>(); try { while (suspendThreads(nodeThreads)) ; - if (!nodeThreads.isEmpty()) { + if (nodeThreads.isEmpty() == false) { Thread.sleep(duration.millis()); } } finally { diff --git a/test/framework/src/main/java/org/elasticsearch/test/disruption/LongGCDisruption.java b/test/framework/src/main/java/org/elasticsearch/test/disruption/LongGCDisruption.java index d9fe62b8f478c..090b516f13802 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/disruption/LongGCDisruption.java +++ b/test/framework/src/main/java/org/elasticsearch/test/disruption/LongGCDisruption.java @@ -284,7 +284,7 @@ protected boolean suspendThreads(Set nodeThreads) { } safe = definitelySafe; } finally { - if (!safe) { + if (safe == false) { /* * Do not log before resuming as we might be interrupted while logging in which case we will throw an * interrupted exception and never resume the suspended thread that is in a critical section. Also, logging diff --git a/test/framework/src/main/java/org/elasticsearch/test/disruption/NetworkDisruption.java b/test/framework/src/main/java/org/elasticsearch/test/disruption/NetworkDisruption.java index 574b392ed0113..dce625d187374 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/disruption/NetworkDisruption.java +++ b/test/framework/src/main/java/org/elasticsearch/test/disruption/NetworkDisruption.java @@ -145,7 +145,7 @@ public synchronized void startDisrupting() { @Override public synchronized void stopDisrupting() { - if (!activeDisruption) { + if (activeDisruption == false) { return; } logger.info("stop disrupting (disruption scheme: {}, disrupted links: {})", networkLinkDisruptionType, disruptedLinks); diff --git a/test/framework/src/main/java/org/elasticsearch/test/disruption/SingleNodeDisruption.java b/test/framework/src/main/java/org/elasticsearch/test/disruption/SingleNodeDisruption.java index 6a821293bf5e0..25d7bdfb0a335 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/disruption/SingleNodeDisruption.java +++ b/test/framework/src/main/java/org/elasticsearch/test/disruption/SingleNodeDisruption.java @@ -64,7 +64,7 @@ public synchronized void removeFromNode(String node, InternalTestCluster cluster if (disruptedNode == null) { return; } - if (!node.equals(disruptedNode)) { + if (node.equals(disruptedNode) == false) { return; } stopDisrupting(); diff --git a/test/framework/src/main/java/org/elasticsearch/test/disruption/SlowClusterStateProcessing.java b/test/framework/src/main/java/org/elasticsearch/test/disruption/SlowClusterStateProcessing.java index 02e6b6a6b19bd..d2a17d64fd195 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/disruption/SlowClusterStateProcessing.java +++ b/test/framework/src/main/java/org/elasticsearch/test/disruption/SlowClusterStateProcessing.java @@ -109,7 +109,7 @@ private boolean interruptClusterStateProcessing(final TimeValue duration) throws for (; count > 0 && !stopped.get(); count--) { Thread.sleep(200); } - if (!stopped.get()) { + if (stopped.get() == false) { Thread.sleep(duration.millis() % 200); } countDownLatch.countDown(); @@ -146,7 +146,7 @@ public void run() { while (disrupting && disruptedNode != null) { try { TimeValue duration = new TimeValue(delayDurationMin + random.nextInt((int) (delayDurationMax - delayDurationMin))); - if (!interruptClusterStateProcessing(duration)) { + if (interruptClusterStateProcessing(duration) == false) { continue; } if (intervalBetweenDelaysMax > 0) { diff --git a/test/framework/src/main/java/org/elasticsearch/test/hamcrest/CollectionMatchers.java b/test/framework/src/main/java/org/elasticsearch/test/hamcrest/CollectionMatchers.java index 02a50d4164570..29f5d425802bd 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/hamcrest/CollectionMatchers.java +++ b/test/framework/src/main/java/org/elasticsearch/test/hamcrest/CollectionMatchers.java @@ -71,7 +71,7 @@ public ImmutableOpenMapHasAllKeysMatcher(final String... keys) { @Override protected boolean matchesSafely(ImmutableOpenMap item) { for (String key: keys) { - if (!item.containsKey(key)) { + if (item.containsKey(key) == false) { missingKey = key; return false; } diff --git a/test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java b/test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java index f8c0c4daad69c..689a0f840fdcf 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java +++ b/test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java @@ -174,7 +174,7 @@ private ReproduceErrorMessageBuilder appendESProperties() { } appendProperties("tests.assertion.disabled", "tests.security.manager", "tests.nightly", "tests.jvms", "tests.client.ratio", "tests.heap.size", "tests.bwc", "tests.bwc.version", "build.snapshot"); - if (System.getProperty("tests.jvm.argline") != null && !System.getProperty("tests.jvm.argline").isEmpty()) { + if (System.getProperty("tests.jvm.argline") != null && System.getProperty("tests.jvm.argline").isEmpty() == false) { appendOpt("tests.jvm.argline", "\"" + System.getProperty("tests.jvm.argline") + "\""); } appendOpt("tests.locale", Locale.getDefault().toLanguageTag()); diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java index dc9bebdd9ce18..fa3d152d33ebe 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java @@ -1043,7 +1043,7 @@ protected static void configureClient(RestClientBuilder builder, Settings settin throw new IllegalStateException(TRUSTSTORE_PATH + " is provided but not " + TRUSTSTORE_PASSWORD); } Path path = PathUtils.get(keystorePath); - if (!Files.exists(path)) { + if (Files.exists(path) == false) { throw new IllegalStateException(TRUSTSTORE_PATH + " is set but points to a non-existing file"); } try { @@ -1061,7 +1061,7 @@ protected static void configureClient(RestClientBuilder builder, Settings settin } if (certificateAuthorities != null) { Path path = PathUtils.get(certificateAuthorities); - if (!Files.exists(path)) { + if (Files.exists(path) == false) { throw new IllegalStateException(CERTIFICATE_AUTHORITIES + " is set but points to a non-existing file"); } try { diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/ESClientYamlSuiteTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/ESClientYamlSuiteTestCase.java index 4b4035d194c0b..29d98614550c5 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/ESClientYamlSuiteTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/ESClientYamlSuiteTestCase.java @@ -271,7 +271,7 @@ private static void addSuite(Path root, Path file, Map> files) private static String[] resolvePathsProperty(String propertyName, String defaultValue) { String property = System.getProperty(propertyName); - if (!Strings.hasLength(property)) { + if (Strings.hasLength(property) == false) { return defaultValue == null ? Strings.EMPTY_ARRAY : new String[]{defaultValue}; } else { return property.split(PATHS_SEPARATOR); @@ -291,7 +291,7 @@ private static void validateSpec(ClientYamlSuiteRestSpec restSpec) { for (ClientYamlSuiteRestApi.Path path : restApi.getPaths()) { List methodsList = Arrays.asList(path.getMethods()); if (methodsList.contains("GET") && restApi.isBodySupported()) { - if (!methodsList.contains("POST")) { + if (methodsList.contains("POST") == false) { errorMessage.append("\n- ").append(restApi.getName()) .append(" supports GET with a body but doesn't support POST"); } @@ -378,7 +378,7 @@ public void test() throws IOException { assumeFalse("[" + testCandidate.getTestPath() + "] skipped, reason: in fips 140 mode", inFipsJvm() && testCandidate.getTestSection().getSkipSection().getFeatures().contains("fips_140")); - if (!testCandidate.getSetupSection().isEmpty()) { + if (testCandidate.getSetupSection().isEmpty() == false) { logger.debug("start setup test [{}]", testCandidate.getTestPath()); for (ExecutableSection executableSection : testCandidate.getSetupSection().getExecutableSections()) { executeSection(executableSection); diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/ClientYamlTestSection.java b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/ClientYamlTestSection.java index 0a1b03279f7bb..0c8a89bb46718 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/ClientYamlTestSection.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/ClientYamlTestSection.java @@ -95,7 +95,7 @@ public boolean equals(Object o) { ClientYamlTestSection that = (ClientYamlTestSection) o; - if (name != null ? !name.equals(that.name) : that.name != null) return false; + if (name != null ? name.equals(that.name) == false : that.name != null) return false; return true; } diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/ClientYamlTestSuite.java b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/ClientYamlTestSuite.java index 57070ef8d2c8f..6bd04e6f6df48 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/ClientYamlTestSuite.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/ClientYamlTestSuite.java @@ -47,7 +47,7 @@ */ public class ClientYamlTestSuite { public static ClientYamlTestSuite parse(NamedXContentRegistry executeableSectionRegistry, String api, Path file) throws IOException { - if (!Files.isRegularFile(file)) { + if (Files.isRegularFile(file) == false) { throw new IllegalArgumentException(file.toAbsolutePath() + " is not a file"); } diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/DoSection.java b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/DoSection.java index 47d78258efd66..680b291981df3 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/DoSection.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/DoSection.java @@ -292,7 +292,7 @@ public void execute(ClientYamlTestExecutionContext executionContext) throws IOEx checkWarningHeaders(response.getWarningHeaders(), executionContext.masterVersion()); } catch(ClientYamlTestResponseException e) { ClientYamlTestResponse restTestResponse = e.getRestTestResponse(); - if (!Strings.hasLength(catchParam)) { + if (Strings.hasLength(catchParam) == false) { fail(formatStatusCodeMessage(restTestResponse, "2xx")); } else if (catches.containsKey(catchParam)) { assertStatusCode(restTestResponse); diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/GreaterThanAssertion.java b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/GreaterThanAssertion.java index 57c50bee4e991..9e5521c7f7924 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/GreaterThanAssertion.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/GreaterThanAssertion.java @@ -39,7 +39,7 @@ public class GreaterThanAssertion extends Assertion { public static GreaterThanAssertion parse(XContentParser parser) throws IOException { XContentLocation location = parser.getTokenLocation(); Tuple stringObjectTuple = ParserUtils.parseTuple(parser); - if (! (stringObjectTuple.v2() instanceof Comparable) ) { + if ((stringObjectTuple.v2() instanceof Comparable) == false) { throw new IllegalArgumentException("gt section can only be used with objects that support natural ordering, found " + stringObjectTuple.v2().getClass().getSimpleName()); } diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/GreaterThanEqualToAssertion.java b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/GreaterThanEqualToAssertion.java index c09994acb8998..8352460358a8a 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/GreaterThanEqualToAssertion.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/GreaterThanEqualToAssertion.java @@ -40,7 +40,7 @@ public class GreaterThanEqualToAssertion extends Assertion { public static GreaterThanEqualToAssertion parse(XContentParser parser) throws IOException { XContentLocation location = parser.getTokenLocation(); Tuple stringObjectTuple = ParserUtils.parseTuple(parser); - if (! (stringObjectTuple.v2() instanceof Comparable) ) { + if ((stringObjectTuple.v2() instanceof Comparable) == false) { throw new IllegalArgumentException("gte section can only be used with objects that support natural ordering, found " + stringObjectTuple.v2().getClass().getSimpleName()); } diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/SkipSection.java b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/SkipSection.java index 81eb470892010..34dc5ded31708 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/SkipSection.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/SkipSection.java @@ -88,10 +88,10 @@ public static SkipSection parse(XContentParser parser) throws IOException { parser.nextToken(); - if (!Strings.hasLength(version) && features.isEmpty()) { + if (Strings.hasLength(version) == false && features.isEmpty()) { throw new ParsingException(parser.getTokenLocation(), "version or features is mandatory within skip section"); } - if (Strings.hasLength(version) && !Strings.hasLength(reason)) { + if (Strings.hasLength(version) && Strings.hasLength(reason) == false) { throw new ParsingException(parser.getTokenLocation(), "reason is mandatory within skip version section"); } return new SkipSection(version, features, reason); diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/TeardownSection.java b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/TeardownSection.java index 5eecaa758f0bc..ca4a057990bf4 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/TeardownSection.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/TeardownSection.java @@ -50,7 +50,7 @@ public static TeardownSection parse(XContentParser parser) throws IOException { List executableSections = new ArrayList<>(); while (parser.currentToken() != XContentParser.Token.END_ARRAY) { ParserUtils.advanceToFieldName(parser); - if (!"do".equals(parser.currentName())) { + if ("do".equals(parser.currentName()) == false) { throw new ParsingException(parser.getTokenLocation(), "section [" + parser.currentName() + "] not supported within teardown section"); } diff --git a/test/framework/src/main/java/org/elasticsearch/test/store/MockFSDirectoryFactory.java b/test/framework/src/main/java/org/elasticsearch/test/store/MockFSDirectoryFactory.java index d6657f8a9c8ff..4226cea5e1cc3 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/store/MockFSDirectoryFactory.java +++ b/test/framework/src/main/java/org/elasticsearch/test/store/MockFSDirectoryFactory.java @@ -75,7 +75,7 @@ public static void checkIndex(Logger logger, Store store, ShardId shardId) { logger.info("start check index"); try { Directory dir = store.directory(); - if (!Lucene.indexExists(dir)) { + if (Lucene.indexExists(dir) == false) { return; } try { @@ -83,7 +83,7 @@ public static void checkIndex(Logger logger, Store store, ShardId shardId) { PrintStream out = new PrintStream(os, false, StandardCharsets.UTF_8.name()); CheckIndex.Status status = store.checkIndex(out); out.flush(); - if (!status.clean) { + if (status.clean == false) { IOException failure = new IOException("failed to check index for shard " + shardId + ";index files [" + Arrays.toString(dir.listAll()) + "] os [" + os.bytes().utf8ToString() + "]"); ESTestCase.checkIndexFailures.add(failure); diff --git a/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java b/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java index aade3ff8197d2..562d7d60a2c14 100644 --- a/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java @@ -1565,7 +1565,7 @@ public void handleException(TransportException exp) { } }); - if (!latch.await(10, TimeUnit.SECONDS)) { + if (latch.await(10, TimeUnit.SECONDS) == false) { fail("message round trip did not complete within a sensible time frame"); } @@ -2496,12 +2496,12 @@ public void testProfileSettings() { .build(); Settings globalSettings2 = Settings.builder() - .put("network.tcp.no_delay", !enable) - .put("network.tcp.keep_alive", !enable) + .put("network.tcp.no_delay", enable == false) + .put("network.tcp.keep_alive", enable == false) .put("network.tcp.keep_idle", "43") .put("network.tcp.keep_interval", "8") .put("network.tcp.keep_count", "14") - .put("network.tcp.reuse_address", !enable) + .put("network.tcp.reuse_address", enable == false) .put("network.tcp.send_buffer_size", "4b") .put("network.tcp.receive_buffer_size", "3b") .put("network.publish_host", "another_publish_host") @@ -2524,12 +2524,12 @@ public void testProfileSettings() { .build(); Settings transportSettings2 = Settings.builder() - .put("transport.tcp.no_delay", !enable) - .put("transport.tcp.keep_alive", !enable) + .put("transport.tcp.no_delay", enable == false) + .put("transport.tcp.keep_alive", enable == false) .put("transport.tcp.keep_idle", "43") .put("transport.tcp.keep_interval", "8") .put("transport.tcp.keep_count", "14") - .put("transport.tcp.reuse_address", !enable) + .put("transport.tcp.reuse_address", enable == false) .put("transport.tcp.send_buffer_size", "5b") .put("transport.tcp.receive_buffer_size", "6b") .put("transport.publish_host", "another_publish_host") diff --git a/test/logger-usage/src/main/java/org/elasticsearch/test/loggerusage/ESLoggerUsageChecker.java b/test/logger-usage/src/main/java/org/elasticsearch/test/loggerusage/ESLoggerUsageChecker.java index 501f2fec2ad48..6d1acf5cb25ec 100644 --- a/test/logger-usage/src/main/java/org/elasticsearch/test/loggerusage/ESLoggerUsageChecker.java +++ b/test/logger-usage/src/main/java/org/elasticsearch/test/loggerusage/ESLoggerUsageChecker.java @@ -470,7 +470,7 @@ private static class IntMinMaxTrackingBasicValue extends BasicValue { public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; + if (super.equals(o) == false) return false; IntMinMaxTrackingBasicValue that = (IntMinMaxTrackingBasicValue) o;