mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-25 07:37:19 -04:00
Replace NOT operator with explicit false
check (#67817)
We have an in-house rule to compare explicitly against `false` instead of using the logical not operator (`!`). However, this hasn't historically been enforced, meaning that there are many violations in the source at present. We now have a Checkstyle rule that can detect these cases, but before we can turn it on, we need to fix the existing violations. This is being done over a series of PRs, since there are a lot to fix.
This commit is contained in:
parent
9a1611da80
commit
ad1f876daa
119 changed files with 264 additions and 246 deletions
|
@ -124,7 +124,7 @@ class NoticeTask extends DefaultTask {
|
||||||
if (line.contains('*/')) {
|
if (line.contains('*/')) {
|
||||||
inNotice = false
|
inNotice = false
|
||||||
|
|
||||||
if (!isPackageInfo) {
|
if (isPackageInfo == false) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else if (inNotice) {
|
} else if (inNotice) {
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class ElasticsearchDistribution implements Buildable, Iterable<File> {
|
||||||
private final Property<Boolean> failIfUnavailable;
|
private final Property<Boolean> failIfUnavailable;
|
||||||
private final Configuration extracted;
|
private final Configuration extracted;
|
||||||
private Action<ElasticsearchDistribution> distributionFinalizer;
|
private Action<ElasticsearchDistribution> distributionFinalizer;
|
||||||
private boolean froozen = false;
|
private boolean frozen = false;
|
||||||
|
|
||||||
ElasticsearchDistribution(
|
ElasticsearchDistribution(
|
||||||
String name,
|
String name,
|
||||||
|
@ -207,10 +207,10 @@ public class ElasticsearchDistribution implements Buildable, Iterable<File> {
|
||||||
* runs distribution finalizer logic.
|
* runs distribution finalizer logic.
|
||||||
*/
|
*/
|
||||||
public ElasticsearchDistribution maybeFreeze() {
|
public ElasticsearchDistribution maybeFreeze() {
|
||||||
if (!froozen) {
|
if (frozen == false) {
|
||||||
finalizeValues();
|
finalizeValues();
|
||||||
distributionFinalizer.execute(this);
|
distributionFinalizer.execute(this);
|
||||||
froozen = true;
|
frozen = true;
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class InternalDistributionDownloadPlugin implements InternalPlugin {
|
||||||
resolutions.register("bwc", distributionResolution -> distributionResolution.setResolver((project, distribution) -> {
|
resolutions.register("bwc", distributionResolution -> distributionResolution.setResolver((project, distribution) -> {
|
||||||
BwcVersions.UnreleasedVersionInfo unreleasedInfo = bwcVersions.unreleasedInfo(Version.fromString(distribution.getVersion()));
|
BwcVersions.UnreleasedVersionInfo unreleasedInfo = bwcVersions.unreleasedInfo(Version.fromString(distribution.getVersion()));
|
||||||
if (unreleasedInfo != null) {
|
if (unreleasedInfo != null) {
|
||||||
if (!distribution.getBundledJdk()) {
|
if (distribution.getBundledJdk() == false) {
|
||||||
throw new GradleException(
|
throw new GradleException(
|
||||||
"Configuring a snapshot bwc distribution ('"
|
"Configuring a snapshot bwc distribution ('"
|
||||||
+ distribution.getName()
|
+ distribution.getName()
|
||||||
|
|
|
@ -106,7 +106,7 @@ public abstract class FilePermissionsTask extends DefaultTask {
|
||||||
.map(file -> "Source file is executable: " + file)
|
.map(file -> "Source file is executable: " + file)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (!failures.isEmpty()) {
|
if (failures.isEmpty() == false) {
|
||||||
throw new GradleException("Found invalid file permissions:\n" + String.join("\n", failures));
|
throw new GradleException("Found invalid file permissions:\n" + String.join("\n", failures));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1235,7 +1235,7 @@ public class ElasticsearchNode implements TestClusterConfiguration {
|
||||||
String content = new String(Files.readAllBytes(jvmOptions));
|
String content = new String(Files.readAllBytes(jvmOptions));
|
||||||
Map<String, String> expansions = jvmOptionExpansions();
|
Map<String, String> expansions = jvmOptionExpansions();
|
||||||
for (String origin : expansions.keySet()) {
|
for (String origin : expansions.keySet()) {
|
||||||
if (!content.contains(origin)) {
|
if (content.contains(origin) == false) {
|
||||||
throw new IOException("template property " + origin + " not found in template.");
|
throw new IOException("template property " + origin + " not found in template.");
|
||||||
}
|
}
|
||||||
content = content.replace(origin, expansions.get(origin));
|
content = content.replace(origin, expansions.get(origin));
|
||||||
|
|
|
@ -39,13 +39,13 @@ public final class FileUtils {
|
||||||
return;
|
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));
|
throw new UncheckedIOException(String.format("Cannot create directory '%s' as it already exists, but is not a directory", dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<File> toCreate = new LinkedList<File>();
|
List<File> toCreate = new LinkedList<File>();
|
||||||
File parent = dir.getParentFile();
|
File parent = dir.getParentFile();
|
||||||
while (!parent.exists()) {
|
while (parent.exists() == false) {
|
||||||
toCreate.add(parent);
|
toCreate.add(parent);
|
||||||
parent = parent.getParentFile();
|
parent = parent.getParentFile();
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public final class FileUtils {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
File parentDirToCreateParent = parentDirToCreate.getParentFile();
|
File parentDirToCreateParent = parentDirToCreate.getParentFile();
|
||||||
if (!parentDirToCreateParent.isDirectory()) {
|
if (parentDirToCreateParent.isDirectory() == false) {
|
||||||
throw new UncheckedIOException(
|
throw new UncheckedIOException(
|
||||||
String.format(
|
String.format(
|
||||||
"Cannot create parent directory '%s' when creating directory '%s' as '%s' is not a directory",
|
"Cannot create parent directory '%s' when creating directory '%s' as '%s' is not a directory",
|
||||||
|
@ -65,13 +65,13 @@ public final class FileUtils {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!parentDirToCreate.mkdir() && !parentDirToCreate.isDirectory()) {
|
if (parentDirToCreate.mkdir() == false && parentDirToCreate.isDirectory() == false) {
|
||||||
throw new UncheckedIOException(
|
throw new UncheckedIOException(
|
||||||
String.format("Failed to create parent directory '%s' when creating directory '%s'", parentDirToCreate, dir)
|
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));
|
throw new UncheckedIOException(String.format("Failed to create directory '%s'", dir));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<property name="tokens" value="EXPR"/>
|
<property name="tokens" value="EXPR"/>
|
||||||
<property name="limitedTokens" value="LNOT"/>
|
<property name="limitedTokens" value="LNOT"/>
|
||||||
<property name="maximumNumber" value="0"/>
|
<property name="maximumNumber" value="0"/>
|
||||||
<property name="maximumDepth" value="1"/>
|
<property name="maximumDepth" value="2"/>
|
||||||
<message
|
<message
|
||||||
key="descendant.token.max"
|
key="descendant.token.max"
|
||||||
value="Do not negate boolean expressions with '!', but check explicitly with '== false' as it is more explicit"/>
|
value="Do not negate boolean expressions with '!', but check explicitly with '== false' as it is more explicit"/>
|
||||||
|
|
|
@ -37,7 +37,7 @@ public final class MetricsCalculator {
|
||||||
Map<String, List<Sample>> samplesPerOperation = new HashMap<>();
|
Map<String, List<Sample>> samplesPerOperation = new HashMap<>();
|
||||||
|
|
||||||
for (Sample sample : samples) {
|
for (Sample sample : samples) {
|
||||||
if (!samplesPerOperation.containsKey(sample.getOperation())) {
|
if (samplesPerOperation.containsKey(sample.getOperation()) == false) {
|
||||||
samplesPerOperation.put(sample.getOperation(), new ArrayList<>());
|
samplesPerOperation.put(sample.getOperation(), new ArrayList<>());
|
||||||
}
|
}
|
||||||
samplesPerOperation.get(sample.getOperation()).add(sample);
|
samplesPerOperation.get(sample.getOperation()).add(sample);
|
||||||
|
|
|
@ -78,7 +78,7 @@ final class IngestRequestConverters {
|
||||||
|
|
||||||
static Request simulatePipeline(SimulatePipelineRequest simulatePipelineRequest) throws IOException {
|
static Request simulatePipeline(SimulatePipelineRequest simulatePipelineRequest) throws IOException {
|
||||||
RequestConverters.EndpointBuilder builder = new RequestConverters.EndpointBuilder().addPathPartAsIs("_ingest/pipeline");
|
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.addPathPart(simulatePipelineRequest.getId());
|
||||||
}
|
}
|
||||||
builder.addPathPartAsIs("_simulate");
|
builder.addPathPartAsIs("_simulate");
|
||||||
|
|
|
@ -158,7 +158,7 @@ public final class GetAutoFollowPatternResponse {
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
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;
|
Pattern pattern = (Pattern) o;
|
||||||
return Objects.equals(remoteCluster, pattern.remoteCluster) &&
|
return Objects.equals(remoteCluster, pattern.remoteCluster) &&
|
||||||
Objects.equals(leaderIndexPatterns, pattern.leaderIndexPatterns) &&
|
Objects.equals(leaderIndexPatterns, pattern.leaderIndexPatterns) &&
|
||||||
|
|
|
@ -81,7 +81,7 @@ public final class PutAutoFollowPatternRequest extends FollowConfig implements V
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
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;
|
PutAutoFollowPatternRequest that = (PutAutoFollowPatternRequest) o;
|
||||||
return Objects.equals(name, that.name) &&
|
return Objects.equals(name, that.name) &&
|
||||||
Objects.equals(remoteCluster, that.remoteCluster) &&
|
Objects.equals(remoteCluster, that.remoteCluster) &&
|
||||||
|
|
|
@ -79,7 +79,7 @@ public final class PutFollowRequest extends FollowConfig implements Validatable,
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
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;
|
PutFollowRequest that = (PutFollowRequest) o;
|
||||||
return Objects.equals(waitForActiveShards, that.waitForActiveShards) &&
|
return Objects.equals(waitForActiveShards, that.waitForActiveShards) &&
|
||||||
Objects.equals(remoteCluster, that.remoteCluster) &&
|
Objects.equals(remoteCluster, that.remoteCluster) &&
|
||||||
|
|
|
@ -50,7 +50,7 @@ public final class ResumeFollowRequest extends FollowConfig implements Validatab
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
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;
|
ResumeFollowRequest that = (ResumeFollowRequest) o;
|
||||||
return Objects.equals(followerIndex, that.followerIndex);
|
return Objects.equals(followerIndex, that.followerIndex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class MultiTermVectorsResponse {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) return true;
|
if (this == obj) return true;
|
||||||
if (!(obj instanceof MultiTermVectorsResponse)) return false;
|
if ((obj instanceof MultiTermVectorsResponse) == false) return false;
|
||||||
MultiTermVectorsResponse other = (MultiTermVectorsResponse) obj;
|
MultiTermVectorsResponse other = (MultiTermVectorsResponse) obj;
|
||||||
return Objects.equals(responses, other.responses);
|
return Objects.equals(responses, other.responses);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,14 +23,15 @@ import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
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.Collections;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.constructorArg;
|
||||||
|
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg;
|
||||||
|
|
||||||
public class TermVectorsResponse {
|
public class TermVectorsResponse {
|
||||||
private final String index;
|
private final String index;
|
||||||
private final String id;
|
private final String id;
|
||||||
|
@ -127,7 +128,7 @@ public class TermVectorsResponse {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) return true;
|
if (this == obj) return true;
|
||||||
if (!(obj instanceof TermVectorsResponse)) return false;
|
if ((obj instanceof TermVectorsResponse) == false) return false;
|
||||||
TermVectorsResponse other = (TermVectorsResponse) obj;
|
TermVectorsResponse other = (TermVectorsResponse) obj;
|
||||||
return index.equals(other.index)
|
return index.equals(other.index)
|
||||||
&& Objects.equals(id, other.id)
|
&& Objects.equals(id, other.id)
|
||||||
|
@ -203,7 +204,7 @@ public class TermVectorsResponse {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) return true;
|
if (this == obj) return true;
|
||||||
if (!(obj instanceof TermVector)) return false;
|
if ((obj instanceof TermVector) == false) return false;
|
||||||
TermVector other = (TermVector) obj;
|
TermVector other = (TermVector) obj;
|
||||||
return fieldName.equals(other.fieldName)
|
return fieldName.equals(other.fieldName)
|
||||||
&& Objects.equals(fieldStatistics, other.fieldStatistics)
|
&& Objects.equals(fieldStatistics, other.fieldStatistics)
|
||||||
|
@ -267,7 +268,7 @@ public class TermVectorsResponse {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) return true;
|
if (this == obj) return true;
|
||||||
if (!(obj instanceof FieldStatistics)) return false;
|
if ((obj instanceof FieldStatistics) == false) return false;
|
||||||
FieldStatistics other = (FieldStatistics) obj;
|
FieldStatistics other = (FieldStatistics) obj;
|
||||||
return docCount == other.docCount
|
return docCount == other.docCount
|
||||||
&& sumDocFreq == other.sumDocFreq
|
&& sumDocFreq == other.sumDocFreq
|
||||||
|
@ -374,7 +375,7 @@ public class TermVectorsResponse {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) return true;
|
if (this == obj) return true;
|
||||||
if (!(obj instanceof Term)) return false;
|
if ((obj instanceof Term) == false) return false;
|
||||||
Term other = (Term) obj;
|
Term other = (Term) obj;
|
||||||
return term.equals(other.term)
|
return term.equals(other.term)
|
||||||
&& termFreq == other.termFreq
|
&& termFreq == other.termFreq
|
||||||
|
@ -456,7 +457,7 @@ public class TermVectorsResponse {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) return true;
|
if (this == obj) return true;
|
||||||
if (!(obj instanceof Token)) return false;
|
if ((obj instanceof Token) == false) return false;
|
||||||
Token other = (Token) obj;
|
Token other = (Token) obj;
|
||||||
return Objects.equals(startOffset, other.startOffset)
|
return Objects.equals(startOffset, other.startOffset)
|
||||||
&& Objects.equals(endOffset,other.endOffset)
|
&& Objects.equals(endOffset,other.endOffset)
|
||||||
|
|
|
@ -179,9 +179,9 @@ public class Connection {
|
||||||
|
|
||||||
ConnectionId vertexId = (ConnectionId) 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;
|
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 false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -237,9 +237,9 @@ public class Vertex implements ToXContentFragment {
|
||||||
|
|
||||||
VertexId vertexId = (VertexId) 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;
|
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 false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class GetLifecyclePolicyResponse implements ToXContentObject {
|
||||||
ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.currentToken(), parser);
|
ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.currentToken(), parser);
|
||||||
parser.nextToken();
|
parser.nextToken();
|
||||||
|
|
||||||
while (!parser.isClosed()) {
|
while (parser.isClosed() == false) {
|
||||||
if (parser.currentToken() == XContentParser.Token.START_OBJECT) {
|
if (parser.currentToken() == XContentParser.Token.START_OBJECT) {
|
||||||
String policyName = parser.currentName();
|
String policyName = parser.currentName();
|
||||||
LifecyclePolicyMetadata policyDefinion = LifecyclePolicyMetadata.parse(parser, policyName);
|
LifecyclePolicyMetadata policyDefinion = LifecyclePolicyMetadata.parse(parser, policyName);
|
||||||
|
|
|
@ -157,7 +157,7 @@ public class GetFieldMappingsResponse {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (!(o instanceof FieldMappingMetadata)) return false;
|
if ((o instanceof FieldMappingMetadata) == false) return false;
|
||||||
FieldMappingMetadata that = (FieldMappingMetadata) o;
|
FieldMappingMetadata that = (FieldMappingMetadata) o;
|
||||||
return Objects.equals(fullName, that.fullName) && Objects.equals(source, that.source);
|
return Objects.equals(fullName, that.fullName) && Objects.equals(source, that.source);
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ public class GetFieldMappingsResponse {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (!(o instanceof GetFieldMappingsResponse)) return false;
|
if ((o instanceof GetFieldMappingsResponse) == false) return false;
|
||||||
GetFieldMappingsResponse that = (GetFieldMappingsResponse) o;
|
GetFieldMappingsResponse that = (GetFieldMappingsResponse) o;
|
||||||
return Objects.equals(mappings, that.mappings);
|
return Objects.equals(mappings, that.mappings);
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,7 +216,7 @@ public class GetIndexResponse {
|
||||||
ensureExpectedToken(Token.START_OBJECT, parser.currentToken(), parser);
|
ensureExpectedToken(Token.START_OBJECT, parser.currentToken(), parser);
|
||||||
parser.nextToken();
|
parser.nextToken();
|
||||||
|
|
||||||
while (!parser.isClosed()) {
|
while (parser.isClosed() == false) {
|
||||||
if (parser.currentToken() == Token.START_OBJECT) {
|
if (parser.currentToken() == Token.START_OBJECT) {
|
||||||
// we assume this is an index entry
|
// we assume this is an index entry
|
||||||
String indexName = parser.currentName();
|
String indexName = parser.currentName();
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class ResizeResponse extends ShardsAcknowledgedResponse {
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
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;
|
ResizeResponse that = (ResizeResponse) o;
|
||||||
return Objects.equals(index, that.index);
|
return Objects.equals(index, that.index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ public final class PutLicenseResponse {
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
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;
|
PutLicenseResponse that = (PutLicenseResponse) o;
|
||||||
|
|
||||||
return status == that.status &&
|
return status == that.status &&
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class GetUsersRequest implements Validatable {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (!(o instanceof GetUsersRequest)) return false;
|
if ((o instanceof GetUsersRequest) == false) return false;
|
||||||
GetUsersRequest that = (GetUsersRequest) o;
|
GetUsersRequest that = (GetUsersRequest) o;
|
||||||
return Objects.equals(usernames, that.usernames);
|
return Objects.equals(usernames, that.usernames);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class GetUsersResponse {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (!(o instanceof GetUsersResponse)) return false;
|
if ((o instanceof GetUsersResponse) == false) return false;
|
||||||
GetUsersResponse that = (GetUsersResponse) o;
|
GetUsersResponse that = (GetUsersResponse) o;
|
||||||
return Objects.equals(users, that.users);
|
return Objects.equals(users, that.users);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class CancelTasksRequest implements Validatable {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (!(o instanceof CancelTasksRequest)) return false;
|
if ((o instanceof CancelTasksRequest) == false) return false;
|
||||||
CancelTasksRequest that = (CancelTasksRequest) o;
|
CancelTasksRequest that = (CancelTasksRequest) o;
|
||||||
return Objects.equals(getNodes(), that.getNodes()) &&
|
return Objects.equals(getNodes(), that.getNodes()) &&
|
||||||
Objects.equals(getActions(), that.getActions()) &&
|
Objects.equals(getActions(), that.getActions()) &&
|
||||||
|
|
|
@ -200,7 +200,7 @@ public class ElasticsearchException {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (!(o instanceof ElasticsearchException)) return false;
|
if ((o instanceof ElasticsearchException) == false) return false;
|
||||||
ElasticsearchException that = (ElasticsearchException) o;
|
ElasticsearchException that = (ElasticsearchException) o;
|
||||||
return Objects.equals(getMsg(), that.getMsg()) &&
|
return Objects.equals(getMsg(), that.getMsg()) &&
|
||||||
Objects.equals(getCause(), that.getCause()) &&
|
Objects.equals(getCause(), that.getCause()) &&
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class GetTaskRequest implements Validatable {
|
||||||
@Override
|
@Override
|
||||||
public Optional<ValidationException> validate() {
|
public Optional<ValidationException> validate() {
|
||||||
final ValidationException validationException = new ValidationException();
|
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");
|
validationException.addValidationError("Timeout settings are only accepted if waitForCompletion is also set");
|
||||||
}
|
}
|
||||||
if (validationException.validationErrors().isEmpty()) {
|
if (validationException.validationErrors().isEmpty()) {
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class ListTasksResponse {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (!(o instanceof ListTasksResponse)) return false;
|
if ((o instanceof ListTasksResponse) == false) return false;
|
||||||
ListTasksResponse response = (ListTasksResponse) o;
|
ListTasksResponse response = (ListTasksResponse) o;
|
||||||
return nodesInfoData.equals(response.nodesInfoData) &&
|
return nodesInfoData.equals(response.nodesInfoData) &&
|
||||||
Objects.equals
|
Objects.equals
|
||||||
|
|
|
@ -124,7 +124,7 @@ class NodeData {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (!(o instanceof NodeData)) return false;
|
if ((o instanceof NodeData) == false) return false;
|
||||||
NodeData nodeData = (NodeData) o;
|
NodeData nodeData = (NodeData) o;
|
||||||
return Objects.equals(getNodeId(), nodeData.getNodeId()) &&
|
return Objects.equals(getNodeId(), nodeData.getNodeId()) &&
|
||||||
Objects.equals(getName(), nodeData.getName()) &&
|
Objects.equals(getName(), nodeData.getName()) &&
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class TaskGroup {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (!(o instanceof TaskGroup)) return false;
|
if ((o instanceof TaskGroup) == false) return false;
|
||||||
TaskGroup taskGroup = (TaskGroup) o;
|
TaskGroup taskGroup = (TaskGroup) o;
|
||||||
return Objects.equals(task, taskGroup.task) &&
|
return Objects.equals(task, taskGroup.task) &&
|
||||||
Objects.equals(getChildTasks(), taskGroup.getChildTasks());
|
Objects.equals(getChildTasks(), taskGroup.getChildTasks());
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class TaskId {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (!(o instanceof TaskId)) return false;
|
if ((o instanceof TaskId) == false) return false;
|
||||||
TaskId taskId = (TaskId) o;
|
TaskId taskId = (TaskId) o;
|
||||||
return getId() == taskId.getId() &&
|
return getId() == taskId.getId() &&
|
||||||
Objects.equals(getNodeId(), taskId.getNodeId());
|
Objects.equals(getNodeId(), taskId.getNodeId());
|
||||||
|
|
|
@ -153,7 +153,7 @@ public class TaskInfo {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (!(o instanceof TaskInfo)) return false;
|
if ((o instanceof TaskInfo) == false) return false;
|
||||||
TaskInfo taskInfo = (TaskInfo) o;
|
TaskInfo taskInfo = (TaskInfo) o;
|
||||||
return getStartTime() == taskInfo.getStartTime() &&
|
return getStartTime() == taskInfo.getStartTime() &&
|
||||||
getRunningTimeNanos() == taskInfo.getRunningTimeNanos() &&
|
getRunningTimeNanos() == taskInfo.getRunningTimeNanos() &&
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class TaskOperationFailure {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (!(o instanceof TaskOperationFailure)) return false;
|
if ((o instanceof TaskOperationFailure) == false) return false;
|
||||||
TaskOperationFailure that = (TaskOperationFailure) o;
|
TaskOperationFailure that = (TaskOperationFailure) o;
|
||||||
return getTaskId() == that.getTaskId() &&
|
return getTaskId() == that.getTaskId() &&
|
||||||
Objects.equals(getNodeId(), that.getNodeId()) &&
|
Objects.equals(getNodeId(), that.getNodeId()) &&
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class AckWatchRequest implements Validatable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!exception.validationErrors().isEmpty()) {
|
if (exception.validationErrors().isEmpty() == false) {
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,8 +128,9 @@ public class IngestRequestConvertersTests extends ESTestCase {
|
||||||
Request expectedRequest = IngestRequestConverters.simulatePipeline(request);
|
Request expectedRequest = IngestRequestConverters.simulatePipeline(request);
|
||||||
StringJoiner endpoint = new StringJoiner("/", "/", "");
|
StringJoiner endpoint = new StringJoiner("/", "/", "");
|
||||||
endpoint.add("_ingest/pipeline");
|
endpoint.add("_ingest/pipeline");
|
||||||
if (pipelineId != null && !pipelineId.isEmpty())
|
if (pipelineId != null && pipelineId.isEmpty() == false) {
|
||||||
endpoint.add(pipelineId);
|
endpoint.add(pipelineId);
|
||||||
|
}
|
||||||
endpoint.add("_simulate");
|
endpoint.add("_simulate");
|
||||||
Assert.assertEquals(endpoint.toString(), expectedRequest.getEndpoint());
|
Assert.assertEquals(endpoint.toString(), expectedRequest.getEndpoint());
|
||||||
Assert.assertEquals(HttpPost.METHOD_NAME, expectedRequest.getMethod());
|
Assert.assertEquals(HttpPost.METHOD_NAME, expectedRequest.getMethod());
|
||||||
|
|
|
@ -1509,7 +1509,7 @@ public class RequestConvertersTests extends ESTestCase {
|
||||||
// Verify that the resulting REST request looks as expected.
|
// Verify that the resulting REST request looks as expected.
|
||||||
StringJoiner endpoint = new StringJoiner("/", "/", "");
|
StringJoiner endpoint = new StringJoiner("/", "/", "");
|
||||||
String joinedIndices = String.join(",", indices);
|
String joinedIndices = String.join(",", indices);
|
||||||
if (!joinedIndices.isEmpty()) {
|
if (joinedIndices.isEmpty() == false) {
|
||||||
endpoint.add(joinedIndices);
|
endpoint.add(joinedIndices);
|
||||||
}
|
}
|
||||||
endpoint.add("_field_caps");
|
endpoint.add("_field_caps");
|
||||||
|
@ -1550,7 +1550,7 @@ public class RequestConvertersTests extends ESTestCase {
|
||||||
// Verify that the resulting REST request looks as expected.
|
// Verify that the resulting REST request looks as expected.
|
||||||
StringJoiner endpoint = new StringJoiner("/", "/", "");
|
StringJoiner endpoint = new StringJoiner("/", "/", "");
|
||||||
String joinedIndices = String.join(",", indices);
|
String joinedIndices = String.join(",", indices);
|
||||||
if (!joinedIndices.isEmpty()) {
|
if (joinedIndices.isEmpty() == false) {
|
||||||
endpoint.add(joinedIndices);
|
endpoint.add(joinedIndices);
|
||||||
}
|
}
|
||||||
endpoint.add("_field_caps");
|
endpoint.add("_field_caps");
|
||||||
|
|
|
@ -960,7 +960,7 @@ public class RestHighLevelClientTests extends ESTestCase {
|
||||||
method.getReturnType().getSimpleName(), equalTo("boolean"));
|
method.getReturnType().getSimpleName(), equalTo("boolean"));
|
||||||
} else {
|
} else {
|
||||||
// It's acceptable for 404s to be represented as empty Optionals
|
// 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",
|
assertThat("the return type for method [" + method + "] is incorrect",
|
||||||
method.getReturnType().getSimpleName(), endsWith("Response"));
|
method.getReturnType().getSimpleName(), endsWith("Response"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class DetectionRuleTests extends AbstractXContentTestCase<DetectionRule>
|
||||||
boolean hasScope = randomBoolean();
|
boolean hasScope = randomBoolean();
|
||||||
boolean hasConditions = randomBoolean();
|
boolean hasConditions = randomBoolean();
|
||||||
|
|
||||||
if (!hasScope && !hasConditions) {
|
if (hasScope == false && hasConditions == false) {
|
||||||
// at least one of the two should be present
|
// at least one of the two should be present
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
hasScope = true;
|
hasScope = true;
|
||||||
|
|
|
@ -73,7 +73,7 @@ public final class PreferHasAttributeNodeSelector implements NodeSelector {
|
||||||
|
|
||||||
List<String> values = attributes.get(key);
|
List<String> values = attributes.get(key);
|
||||||
|
|
||||||
if (values == null || !values.contains(value)) {
|
if (values == null || values.contains(value) == false) {
|
||||||
nodeIterator.remove();
|
nodeIterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class JavaVersion {
|
||||||
public static final List<Integer> JAVA_11 = parse("11");
|
public static final List<Integer> JAVA_11 = parse("11");
|
||||||
|
|
||||||
static List<Integer> parse(final String value) {
|
static List<Integer> 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);
|
throw new IllegalArgumentException(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -723,7 +723,7 @@ class InstallPluginCommand extends EnvironmentAwareCommand {
|
||||||
|
|
||||||
// be on the safe side: do not rely on that directories are always extracted
|
// 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?)
|
// 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());
|
Files.createDirectories(targetFile.getParent());
|
||||||
}
|
}
|
||||||
if (entry.isDirectory() == false) {
|
if (entry.isDirectory() == false) {
|
||||||
|
|
|
@ -136,7 +136,7 @@ class RemovePluginCommand extends EnvironmentAwareCommand {
|
||||||
|
|
||||||
final Path pluginBinDir = env.binFile().resolve(pluginName);
|
final Path pluginBinDir = env.binFile().resolve(pluginName);
|
||||||
if (Files.exists(pluginBinDir)) {
|
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");
|
throw new UserException(ExitCodes.IO_ERROR, "bin dir for " + pluginName + " is not a directory");
|
||||||
}
|
}
|
||||||
try (Stream<Path> paths = Files.list(pluginBinDir)) {
|
try (Stream<Path> paths = Files.list(pluginBinDir)) {
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class JarHell {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (path.toString().endsWith(".jar")) {
|
if (path.toString().endsWith(".jar")) {
|
||||||
if (!seenJars.add(path)) {
|
if (seenJars.add(path) == false) {
|
||||||
throw new IllegalStateException("jar hell!" + System.lineSeparator() +
|
throw new IllegalStateException("jar hell!" + System.lineSeparator() +
|
||||||
"duplicate jar on classpath: " + path);
|
"duplicate jar on classpath: " + path);
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ public class JarHell {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkVersionFormat(String targetVersion) {
|
public static void checkVersionFormat(String targetVersion) {
|
||||||
if (!JavaVersion.isValid(targetVersion)) {
|
if (JavaVersion.isValid(targetVersion) == false) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
String.format(
|
String.format(
|
||||||
Locale.ROOT,
|
Locale.ROOT,
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class JavaVersion implements Comparable<JavaVersion> {
|
||||||
public static JavaVersion parse(String value) {
|
public static JavaVersion parse(String value) {
|
||||||
Objects.requireNonNull(value);
|
Objects.requireNonNull(value);
|
||||||
String prePart = null;
|
String prePart = null;
|
||||||
if (!isValid(value)) {
|
if (isValid(value) == false) {
|
||||||
throw new IllegalArgumentException("Java version string [" + value + "] could not be parsed.");
|
throw new IllegalArgumentException("Java version string [" + value + "] could not be parsed.");
|
||||||
}
|
}
|
||||||
List<Integer> version = new ArrayList<>();
|
List<Integer> version = new ArrayList<>();
|
||||||
|
|
|
@ -79,7 +79,7 @@ public final class Booleans {
|
||||||
}
|
}
|
||||||
int strLen = str.length();
|
int strLen = str.length();
|
||||||
for (int i = 0; i < strLen; i++) {
|
for (int i = 0; i < strLen; i++) {
|
||||||
if (!Character.isWhitespace(str.charAt(i))) {
|
if (Character.isWhitespace(str.charAt(i)) == false) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,16 @@ public final class Booleans {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return defaultValue;
|
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 final class Booleans {
|
||||||
return text[offset] != '0';
|
return text[offset] != '0';
|
||||||
}
|
}
|
||||||
if (length == 2) {
|
if (length == 2) {
|
||||||
return !(text[offset] == 'n' && text[offset + 1] == 'o');
|
return (text[offset] == 'n' && text[offset + 1] == 'o') == false;
|
||||||
}
|
}
|
||||||
if (length == 3) {
|
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) {
|
if (length == 5) {
|
||||||
return !(text[offset] == 'f' && text[offset + 1] == 'a' && text[offset + 2] == 'l' && text[offset + 3] == 's' &&
|
return (text[offset] == 'f' && text[offset + 1] == 'a' && text[offset + 2] == 'l' && text[offset + 3] == 's' &&
|
||||||
text[offset + 4] == 'e');
|
text[offset + 4] == 'e') == false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,8 +48,8 @@ public class Tuple<V1, V2> {
|
||||||
|
|
||||||
Tuple<?, ?> tuple = (Tuple<?, ?>) o;
|
Tuple<?, ?> tuple = (Tuple<?, ?>) o;
|
||||||
|
|
||||||
if (v1 != null ? !v1.equals(tuple.v1) : tuple.v1 != null) return false;
|
if (v1 != null ? v1.equals(tuple.v1) == false : tuple.v1 != null) return false;
|
||||||
if (v2 != null ? !v2.equals(tuple.v2) : tuple.v2 != null) return false;
|
if (v2 != null ? v2.equals(tuple.v2) == false : tuple.v2 != null) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,7 @@ public final class IOUtils {
|
||||||
*/
|
*/
|
||||||
public static void rm(final Path... locations) throws IOException {
|
public static void rm(final Path... locations) throws IOException {
|
||||||
final LinkedHashMap<Path,Throwable> unremoved = rm(new LinkedHashMap<>(), locations);
|
final LinkedHashMap<Path,Throwable> 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");
|
final StringBuilder b = new StringBuilder("could not remove the following files (in the order of attempts):\n");
|
||||||
for (final Map.Entry<Path,Throwable> kv : unremoved.entrySet()) {
|
for (final Map.Entry<Path,Throwable> kv : unremoved.entrySet()) {
|
||||||
b.append(" ")
|
b.append(" ")
|
||||||
|
|
|
@ -174,13 +174,13 @@ public final class DissectKey {
|
||||||
|
|
||||||
private static Modifier findModifier(String key) {
|
private static Modifier findModifier(String key) {
|
||||||
Modifier modifier = Modifier.NONE;
|
Modifier modifier = Modifier.NONE;
|
||||||
if (key != null && !key.isEmpty()) {
|
if (key != null && key.isEmpty() == false) {
|
||||||
Matcher matcher = MODIFIER_PATTERN.matcher(key);
|
Matcher matcher = MODIFIER_PATTERN.matcher(key);
|
||||||
int matches = 0;
|
int matches = 0;
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
Modifier priorModifier = modifier;
|
Modifier priorModifier = modifier;
|
||||||
modifier = Modifier.fromString(matcher.group());
|
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.");
|
throw new DissectException.KeyParse(key, "multiple modifiers are not allowed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,9 +240,9 @@ public final class DissectParser {
|
||||||
if (lookAheadMatches == delimiter.length) {
|
if (lookAheadMatches == delimiter.length) {
|
||||||
//jump to the end of the match
|
//jump to the end of the match
|
||||||
i += lookAheadMatches;
|
i += lookAheadMatches;
|
||||||
if (!key.skipRightPadding()) {
|
if (key.skipRightPadding() == false) {
|
||||||
//progress the keys/delimiter if possible
|
//progress the keys/delimiter if possible
|
||||||
if (!it.hasNext()) {
|
if (it.hasNext() == false) {
|
||||||
break; //the while loop
|
break; //the while loop
|
||||||
}
|
}
|
||||||
dissectPair = it.next();
|
dissectPair = it.next();
|
||||||
|
@ -255,7 +255,7 @@ public final class DissectParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//progress the keys/delimiter if possible
|
//progress the keys/delimiter if possible
|
||||||
if (!it.hasNext()) {
|
if (it.hasNext() == false) {
|
||||||
break; //the for loop
|
break; //the for loop
|
||||||
}
|
}
|
||||||
dissectPair = it.next();
|
dissectPair = it.next();
|
||||||
|
@ -272,7 +272,7 @@ public final class DissectParser {
|
||||||
}
|
}
|
||||||
//the last key, grab the rest of the input (unless consecutive delimiters already grabbed the last key)
|
//the last key, grab the rest of the input (unless consecutive delimiters already grabbed the last key)
|
||||||
//and there is no trailing delimiter
|
//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);
|
byte[] value = Arrays.copyOfRange(input, valueStart, input.length);
|
||||||
String valueString = new String(value, StandardCharsets.UTF_8);
|
String valueString = new String(value, StandardCharsets.UTF_8);
|
||||||
dissectMatch.add(key, valueString);
|
dissectMatch.add(key, valueString);
|
||||||
|
@ -280,7 +280,7 @@ public final class DissectParser {
|
||||||
}
|
}
|
||||||
Map<String, String> results = dissectMatch.getResults();
|
Map<String, String> results = dissectMatch.getResults();
|
||||||
|
|
||||||
if (!dissectMatch.isValid(results)) {
|
if (dissectMatch.isValid(results) == false) {
|
||||||
throw new DissectException.FindMatch(pattern, inputString);
|
throw new DissectException.FindMatch(pattern, inputString);
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
|
|
|
@ -326,7 +326,7 @@ public class DissectParserTests extends ESTestCase {
|
||||||
while (tests.hasNext()) {
|
while (tests.hasNext()) {
|
||||||
JsonNode test = tests.next();
|
JsonNode test = tests.next();
|
||||||
boolean skip = test.path("skip").asBoolean();
|
boolean skip = test.path("skip").asBoolean();
|
||||||
if (!skip) {
|
if (skip == false) {
|
||||||
String name = test.path("name").asText();
|
String name = test.path("name").asText();
|
||||||
logger.debug("Running Json specification: " + name);
|
logger.debug("Running Json specification: " + name);
|
||||||
String pattern = test.path("tok").asText();
|
String pattern = test.path("tok").asText();
|
||||||
|
|
|
@ -433,7 +433,7 @@ public class WellKnownText {
|
||||||
private void closeLinearRingIfCoerced(ArrayList<Double> lats, ArrayList<Double> lons, ArrayList<Double> alts) {
|
private void closeLinearRingIfCoerced(ArrayList<Double> lats, ArrayList<Double> lons, ArrayList<Double> alts) {
|
||||||
if (coerce && lats.isEmpty() == false && lons.isEmpty() == false) {
|
if (coerce && lats.isEmpty() == false && lons.isEmpty() == false) {
|
||||||
int last = lats.size() - 1;
|
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)))) {
|
(alts.isEmpty() == false && !alts.get(0).equals(alts.get(last)))) {
|
||||||
lons.add(lons.get(0));
|
lons.add(lons.get(0));
|
||||||
lats.add(lats.get(0));
|
lats.add(lats.get(0));
|
||||||
|
|
|
@ -194,8 +194,9 @@ final class DerParser {
|
||||||
* @return A parser for the construct.
|
* @return A parser for the construct.
|
||||||
*/
|
*/
|
||||||
public DerParser getParser() throws IOException {
|
public DerParser getParser() throws IOException {
|
||||||
if (!isConstructed())
|
if (isConstructed() == false) {
|
||||||
throw new IOException("Invalid DER: can't parse primitive entity"); //$NON-NLS-1$
|
throw new IOException("Invalid DER: can't parse primitive entity"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
return new DerParser(value);
|
return new DerParser(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ public abstract class AbstractXContentParser implements XContentParser {
|
||||||
public static final boolean DEFAULT_NUMBER_COERCE_POLICY = true;
|
public static final boolean DEFAULT_NUMBER_COERCE_POLICY = true;
|
||||||
|
|
||||||
private static void checkCoerceString(boolean coerce, Class<? extends Number> clazz) {
|
private static void checkCoerceString(boolean coerce, Class<? extends Number> clazz) {
|
||||||
if (!coerce) {
|
if (coerce == false) {
|
||||||
//Need to throw type IllegalArgumentException as current catch logic in
|
//Need to throw type IllegalArgumentException as current catch logic in
|
||||||
//NumberFieldMapper.parseCreateField relies on this for "malformed" value detection
|
//NumberFieldMapper.parseCreateField relies on this for "malformed" value detection
|
||||||
throw new IllegalArgumentException(clazz.getSimpleName() + " value passed as String");
|
throw new IllegalArgumentException(clazz.getSimpleName() + " value passed as String");
|
||||||
|
@ -68,7 +68,7 @@ public abstract class AbstractXContentParser implements XContentParser {
|
||||||
// If this behaviour is flagged as undesirable and any truncation occurs
|
// If this behaviour is flagged as undesirable and any truncation occurs
|
||||||
// then this method is called to trigger the"malformed" handling logic
|
// then this method is called to trigger the"malformed" handling logic
|
||||||
void ensureNumberConversion(boolean coerce, long result, Class<? extends Number> clazz) throws IOException {
|
void ensureNumberConversion(boolean coerce, long result, Class<? extends Number> clazz) throws IOException {
|
||||||
if (!coerce) {
|
if (coerce == false) {
|
||||||
double fullVal = doDoubleValue();
|
double fullVal = doDoubleValue();
|
||||||
if (result != fullVal) {
|
if (result != fullVal) {
|
||||||
// Need to throw type IllegalArgumentException as current catch
|
// Need to throw type IllegalArgumentException as current catch
|
||||||
|
|
|
@ -49,7 +49,7 @@ final class MatrixStatsAggregator extends MetricsAggregator {
|
||||||
MatrixStatsAggregator(String name, Map<String, ValuesSource.Numeric> valuesSources, AggregationContext context,
|
MatrixStatsAggregator(String name, Map<String, ValuesSource.Numeric> valuesSources, AggregationContext context,
|
||||||
Aggregator parent, MultiValueMode multiValueMode, Map<String,Object> metadata) throws IOException {
|
Aggregator parent, MultiValueMode multiValueMode, Map<String,Object> metadata) throws IOException {
|
||||||
super(name, context, parent, metadata);
|
super(name, context, parent, metadata);
|
||||||
if (valuesSources != null && !valuesSources.isEmpty()) {
|
if (valuesSources != null && valuesSources.isEmpty() == false) {
|
||||||
this.valuesSources = new NumericArrayValuesSource(valuesSources, multiValueMode);
|
this.valuesSources = new NumericArrayValuesSource(valuesSources, multiValueMode);
|
||||||
stats = context.bigArrays().newObjectArray(1);
|
stats = context.bigArrays().newObjectArray(1);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -88,7 +88,7 @@ public abstract class ArrayValuesSourceParser<VS extends ValuesSource> implement
|
||||||
throw new ParsingException(parser.getTokenLocation(),
|
throw new ParsingException(parser.getTokenLocation(),
|
||||||
"Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]. " +
|
"Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]. " +
|
||||||
"Multi-field aggregations do not support scripts.");
|
"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(),
|
throw new ParsingException(parser.getTokenLocation(),
|
||||||
"Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "].");
|
"Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "].");
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public abstract class ArrayValuesSourceParser<VS extends ValuesSource> implement
|
||||||
"Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]. " +
|
"Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]. " +
|
||||||
"Multi-field aggregations do not support scripts.");
|
"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(),
|
throw new ParsingException(parser.getTokenLocation(),
|
||||||
"Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "].");
|
"Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "].");
|
||||||
}
|
}
|
||||||
|
@ -122,11 +122,11 @@ public abstract class ArrayValuesSourceParser<VS extends ValuesSource> implement
|
||||||
"Unexpected token " + token + " [" + currentFieldName + "] in [" + 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(),
|
throw new ParsingException(parser.getTokenLocation(),
|
||||||
"Unexpected token " + token + " [" + currentFieldName + "] in [" + 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(),
|
throw new ParsingException(parser.getTokenLocation(),
|
||||||
"Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "].");
|
"Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "].");
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,8 +64,9 @@ public class MappingCharFilterFactory extends AbstractCharFilterFactory implemen
|
||||||
private void parseRules(List<String> rules, NormalizeCharMap.Builder map) {
|
private void parseRules(List<String> rules, NormalizeCharMap.Builder map) {
|
||||||
for (String rule : rules) {
|
for (String rule : rules) {
|
||||||
Matcher m = rulePattern.matcher(rule);
|
Matcher m = rulePattern.matcher(rule);
|
||||||
if (!m.find())
|
if (m.find() == false) {
|
||||||
throw new RuntimeException("Invalid Mapping Rule : [" + rule + "]");
|
throw new RuntimeException("Invalid Mapping Rule : [" + rule + "]");
|
||||||
|
}
|
||||||
String lhs = parseString(m.group(1).trim());
|
String lhs = parseString(m.group(1).trim());
|
||||||
String rhs = parseString(m.group(2).trim());
|
String rhs = parseString(m.group(2).trim());
|
||||||
if (lhs == null || rhs == null)
|
if (lhs == null || rhs == null)
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class NGramTokenizerFactory extends AbstractTokenizerFactory {
|
||||||
matchers.put("symbol", CharMatcher.Basic.SYMBOL);
|
matchers.put("symbol", CharMatcher.Basic.SYMBOL);
|
||||||
// Populate with unicode categories from java.lang.Character
|
// Populate with unicode categories from java.lang.Character
|
||||||
for (Field field : Character.class.getFields()) {
|
for (Field field : Character.class.getFields()) {
|
||||||
if (!field.getName().startsWith("DIRECTIONALITY")
|
if (field.getName().startsWith("DIRECTIONALITY") == false
|
||||||
&& Modifier.isPublic(field.getModifiers())
|
&& Modifier.isPublic(field.getModifiers())
|
||||||
&& Modifier.isStatic(field.getModifiers())
|
&& Modifier.isStatic(field.getModifiers())
|
||||||
&& field.getType() == byte.class) {
|
&& field.getType() == byte.class) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class PatternReplaceCharFilterFactory extends AbstractCharFilterFactory i
|
||||||
super(indexSettings, name);
|
super(indexSettings, name);
|
||||||
|
|
||||||
String sPattern = settings.get("pattern");
|
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'");
|
throw new IllegalArgumentException("pattern is missing for [" + name + "] char filter of type 'pattern_replace'");
|
||||||
}
|
}
|
||||||
pattern = Regex.compile(sPattern, settings.get("flags"));
|
pattern = Regex.compile(sPattern, settings.get("flags"));
|
||||||
|
|
|
@ -71,7 +71,7 @@ class UniqueTokenFilter extends TokenFilter {
|
||||||
System.arraycopy(term, 0, saved, 0, length);
|
System.arraycopy(term, 0, saved, 0, length);
|
||||||
previous.add(saved);
|
previous.add(saved);
|
||||||
|
|
||||||
if (!duplicate) {
|
if (duplicate == false) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,8 +126,9 @@ public class WordDelimiterTokenFilterFactory extends AbstractTokenFilterFactory
|
||||||
SortedMap<Character, Byte> typeMap = new TreeMap<>();
|
SortedMap<Character, Byte> typeMap = new TreeMap<>();
|
||||||
for (String rule : rules) {
|
for (String rule : rules) {
|
||||||
Matcher m = typePattern.matcher(rule);
|
Matcher m = typePattern.matcher(rule);
|
||||||
if (!m.find())
|
if (m.find() == false) {
|
||||||
throw new RuntimeException("Invalid Mapping Rule : [" + rule + "]");
|
throw new RuntimeException("Invalid Mapping Rule : [" + rule + "]");
|
||||||
|
}
|
||||||
String lhs = parseString(m.group(1).trim());
|
String lhs = parseString(m.group(1).trim());
|
||||||
Byte rhs = parseType(m.group(2).trim());
|
Byte rhs = parseType(m.group(2).trim());
|
||||||
if (lhs.length() != 1)
|
if (lhs.length() != 1)
|
||||||
|
|
|
@ -102,7 +102,7 @@ public final class ConvertProcessor extends AbstractProcessor {
|
||||||
}, AUTO {
|
}, AUTO {
|
||||||
@Override
|
@Override
|
||||||
public Object convert(Object value) {
|
public Object convert(Object value) {
|
||||||
if (!(value instanceof String)) {
|
if ((value instanceof String) == false) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -238,7 +238,7 @@ final class UserAgentParser {
|
||||||
String name = null, major = null, minor = null, patch = null, build = null;
|
String name = null, major = null, minor = null, patch = null, build = null;
|
||||||
Matcher matcher = pattern.matcher(agentString);
|
Matcher matcher = pattern.matcher(agentString);
|
||||||
|
|
||||||
if (!matcher.find()) {
|
if (matcher.find() == false) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ class DateMethodValueSource extends FieldDataValueSource {
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
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;
|
DateMethodValueSource that = (DateMethodValueSource) o;
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ class DateObjectValueSource extends FieldDataValueSource {
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
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;
|
DateObjectValueSource that = (DateObjectValueSource) o;
|
||||||
return methodName.equals(that.methodName);
|
return methodName.equals(that.methodName);
|
||||||
|
|
|
@ -445,7 +445,7 @@ public class ExpressionScriptEngine implements ScriptEngine {
|
||||||
dateAccessor = true;
|
dateAccessor = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!dateAccessor) {
|
if (dateAccessor == false) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Variable [" + variable + "] does not follow an allowed format of either doc['field'] or doc['field'].method()"
|
"Variable [" + variable + "] does not follow an allowed format of either doc['field'] or doc['field'].method()"
|
||||||
);
|
);
|
||||||
|
|
|
@ -49,7 +49,7 @@ class FieldDataValueSource extends FieldDataBasedDoubleValuesSource {
|
||||||
|
|
||||||
FieldDataValueSource that = (FieldDataValueSource) o;
|
FieldDataValueSource that = (FieldDataValueSource) o;
|
||||||
|
|
||||||
if (!fieldData.equals(that.fieldData)) return false;
|
if (fieldData.equals(that.fieldData) == false) return false;
|
||||||
return multiValueMode == that.multiValueMode;
|
return multiValueMode == that.multiValueMode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ final class GeoLongitudeValueSource extends FieldDataBasedDoubleValuesSource {
|
||||||
if (obj == null) return false;
|
if (obj == null) return false;
|
||||||
if (getClass() != obj.getClass()) return false;
|
if (getClass() != obj.getClass()) return false;
|
||||||
GeoLongitudeValueSource other = (GeoLongitudeValueSource) obj;
|
GeoLongitudeValueSource other = (GeoLongitudeValueSource) obj;
|
||||||
if (!fieldData.equals(other.fieldData)) return false;
|
if (fieldData.equals(other.fieldData) == false) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ public final class Def {
|
||||||
static int getArrayLength(final Object[] array) { return array.length; }
|
static int getArrayLength(final Object[] array) { return array.length; }
|
||||||
|
|
||||||
static MethodHandle arrayLengthGetter(Class<?> arrayType) {
|
static MethodHandle arrayLengthGetter(Class<?> arrayType) {
|
||||||
if (!arrayType.isArray()) {
|
if (arrayType.isArray() == false) {
|
||||||
throw new IllegalArgumentException("type must be an array");
|
throw new IllegalArgumentException("type must be an array");
|
||||||
}
|
}
|
||||||
return (ARRAY_TYPE_MH_MAPPING.containsKey(arrayType)) ?
|
return (ARRAY_TYPE_MH_MAPPING.containsKey(arrayType)) ?
|
||||||
|
@ -622,7 +622,7 @@ public final class Def {
|
||||||
}
|
}
|
||||||
|
|
||||||
static MethodHandle newIterator(Class<?> arrayType) {
|
static MethodHandle newIterator(Class<?> arrayType) {
|
||||||
if (!arrayType.isArray()) {
|
if (arrayType.isArray() == false) {
|
||||||
throw new IllegalArgumentException("type must be an array");
|
throw new IllegalArgumentException("type must be an array");
|
||||||
}
|
}
|
||||||
return (ARRAY_TYPE_MH_MAPPING.containsKey(arrayType)) ?
|
return (ARRAY_TYPE_MH_MAPPING.containsKey(arrayType)) ?
|
||||||
|
@ -1269,7 +1269,7 @@ public final class Def {
|
||||||
static int normalizeIndex(final Object[] array, final int index) { return index >= 0 ? index : index + array.length; }
|
static int normalizeIndex(final Object[] array, final int index) { return index >= 0 ? index : index + array.length; }
|
||||||
|
|
||||||
static MethodHandle arrayIndexNormalizer(Class<?> arrayType) {
|
static MethodHandle arrayIndexNormalizer(Class<?> arrayType) {
|
||||||
if (!arrayType.isArray()) {
|
if (arrayType.isArray() == false) {
|
||||||
throw new IllegalArgumentException("type must be an array");
|
throw new IllegalArgumentException("type must be an array");
|
||||||
}
|
}
|
||||||
return (ARRAY_TYPE_MH_MAPPING.containsKey(arrayType)) ?
|
return (ARRAY_TYPE_MH_MAPPING.containsKey(arrayType)) ?
|
||||||
|
|
|
@ -244,7 +244,7 @@ public final class MethodWriter extends GeneratorAdapter {
|
||||||
if (from != boolean.class && from.isPrimitive() && to != boolean.class && to.isPrimitive()) {
|
if (from != boolean.class && from.isPrimitive() && to != boolean.class && to.isPrimitive()) {
|
||||||
cast(getType(from), getType(to));
|
cast(getType(from), getType(to));
|
||||||
} else {
|
} else {
|
||||||
if (!to.isAssignableFrom(from)) {
|
if (to.isAssignableFrom(from) == false) {
|
||||||
checkCast(getType(to));
|
checkCast(getType(to));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -357,7 +357,7 @@ public final class MethodWriter extends GeneratorAdapter {
|
||||||
// so we don't need a special NPE guard.
|
// so we don't need a special NPE guard.
|
||||||
// otherwise, we need to allow nulls for possible string concatenation.
|
// otherwise, we need to allow nulls for possible string concatenation.
|
||||||
boolean hasPrimitiveArg = lhs.isPrimitive() || rhs.isPrimitive();
|
boolean hasPrimitiveArg = lhs.isPrimitive() || rhs.isPrimitive();
|
||||||
if (!hasPrimitiveArg) {
|
if (hasPrimitiveArg == false) {
|
||||||
flags |= DefBootstrap.OPERATOR_ALLOWS_NULL;
|
flags |= DefBootstrap.OPERATOR_ALLOWS_NULL;
|
||||||
}
|
}
|
||||||
invokeDefCall("add", methodType, DefBootstrap.BINARY_OPERATOR, flags);
|
invokeDefCall("add", methodType, DefBootstrap.BINARY_OPERATOR, flags);
|
||||||
|
@ -466,7 +466,7 @@ public final class MethodWriter extends GeneratorAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void endMethod() {
|
public void endMethod() {
|
||||||
if (stringConcatArgs != null && !stringConcatArgs.isEmpty()) {
|
if (stringConcatArgs != null && stringConcatArgs.isEmpty() == false) {
|
||||||
throw new IllegalStateException("String concat bytecode not completed.");
|
throw new IllegalStateException("String concat bytecode not completed.");
|
||||||
}
|
}
|
||||||
super.endMethod();
|
super.endMethod();
|
||||||
|
|
|
@ -89,7 +89,7 @@ public interface PainlessScript {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// but filter our own internal stacks (e.g. indy bootstrap)
|
// but filter our own internal stacks (e.g. indy bootstrap)
|
||||||
} else if (!shouldFilter(element)) {
|
} else if (shouldFilter(element) == false) {
|
||||||
scriptStack.add(element.toString());
|
scriptStack.add(element.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -459,7 +459,7 @@ public final class PainlessScriptEngine implements ScriptEngine {
|
||||||
throw new IllegalArgumentException("[painless.regex.limit-factor] can only be set on node startup.");
|
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);
|
throw new IllegalArgumentException("Unrecognized compile-time parameter(s): " + copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1348,7 +1348,7 @@ public class DefaultIRTreeToASMBytesPhase implements IRTreeVisitor<WriteScope> {
|
||||||
PainlessMethod getterPainlessMethod = irDotSubShortcutNode.getDecorationValue(IRDMethod.class);
|
PainlessMethod getterPainlessMethod = irDotSubShortcutNode.getDecorationValue(IRDMethod.class);
|
||||||
methodWriter.invokeMethodCall(getterPainlessMethod);
|
methodWriter.invokeMethodCall(getterPainlessMethod);
|
||||||
|
|
||||||
if (!getterPainlessMethod.returnType.equals(getterPainlessMethod.javaMethod.getReturnType())) {
|
if (getterPainlessMethod.returnType.equals(getterPainlessMethod.javaMethod.getReturnType()) == false) {
|
||||||
methodWriter.checkCast(MethodWriter.getType(getterPainlessMethod.returnType));
|
methodWriter.checkCast(MethodWriter.getType(getterPainlessMethod.returnType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,7 +294,7 @@ public class ChildQuerySearchIT extends ParentChildTestCase {
|
||||||
String childId = "c" + i;
|
String childId = "c" + i;
|
||||||
builders.add(createIndexRequest("test", "child", childId, previousParentId, "c_field", childId));
|
builders.add(createIndexRequest("test", "child", childId, previousParentId, "c_field", childId));
|
||||||
|
|
||||||
if (!parentToChildren.containsKey(previousParentId)) {
|
if (parentToChildren.containsKey(previousParentId) == false) {
|
||||||
parentToChildren.put(previousParentId, new HashSet<>());
|
parentToChildren.put(previousParentId, new HashSet<>());
|
||||||
}
|
}
|
||||||
assertThat(parentToChildren.get(previousParentId).add(childId), is(true));
|
assertThat(parentToChildren.get(previousParentId).add(childId), is(true));
|
||||||
|
|
|
@ -406,9 +406,9 @@ public class HasChildQueryBuilder extends AbstractQueryBuilder<HasChildQueryBuil
|
||||||
|
|
||||||
if (minChildren != that.minChildren) return false;
|
if (minChildren != that.minChildren) return false;
|
||||||
if (maxChildren != that.maxChildren) return false;
|
if (maxChildren != that.maxChildren) return false;
|
||||||
if (!toQuery.equals(that.toQuery)) return false;
|
if (toQuery.equals(that.toQuery) == false) return false;
|
||||||
if (!innerQuery.equals(that.innerQuery)) return false;
|
if (innerQuery.equals(that.innerQuery) == false) return false;
|
||||||
if (!joinField.equals(that.joinField)) return false;
|
if (joinField.equals(that.joinField) == false) return false;
|
||||||
return scoreMode == that.scoreMode;
|
return scoreMode == that.scoreMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -455,7 +455,7 @@ public class PercolateQueryBuilder extends AbstractQueryBuilder<PercolateQueryBu
|
||||||
throw new QueryShardException(context, "field [" + field + "] does not exist");
|
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 +
|
throw new QueryShardException(context, "expected field [" + field +
|
||||||
"] to be of type [percolator], but is of type [" + fieldType.typeName() + "]");
|
"] to be of type [percolator], but is of type [" + fieldType.typeName() + "]");
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ public abstract class AbstractAsyncBulkByScrollAction<Request extends AbstractBu
|
||||||
this.task = task;
|
this.task = task;
|
||||||
this.scriptService = scriptService;
|
this.scriptService = scriptService;
|
||||||
this.sslConfig = sslConfig;
|
this.sslConfig = sslConfig;
|
||||||
if (!task.isWorker()) {
|
if (task.isWorker() == false) {
|
||||||
throw new IllegalArgumentException("Given task [" + task.getId() + "] must have a child worker");
|
throw new IllegalArgumentException("Given task [" + task.getId() + "] must have a child worker");
|
||||||
}
|
}
|
||||||
this.worker = task.getWorkerState();
|
this.worker = task.getWorkerState();
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class Netty4TransportPublishAddressIT extends ESNetty4IntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDifferentPorts() throws Exception {
|
public void testDifferentPorts() throws Exception {
|
||||||
if (!NetworkUtils.SUPPORTS_V6) {
|
if (NetworkUtils.SUPPORTS_V6 == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logger.info("--> starting a node on ipv4 only");
|
logger.info("--> starting a node on ipv4 only");
|
||||||
|
|
|
@ -162,7 +162,7 @@ public class Netty4HttpRequest implements HttpRequest {
|
||||||
String cookieString = request.headers().get(HttpHeaderNames.COOKIE);
|
String cookieString = request.headers().get(HttpHeaderNames.COOKIE);
|
||||||
if (cookieString != null) {
|
if (cookieString != null) {
|
||||||
Set<Cookie> cookies = ServerCookieDecoder.STRICT.decode(cookieString);
|
Set<Cookie> cookies = ServerCookieDecoder.STRICT.decode(cookieString);
|
||||||
if (!cookies.isEmpty()) {
|
if (cookies.isEmpty() == false) {
|
||||||
return ServerCookieEncoder.STRICT.encode(cookies);
|
return ServerCookieEncoder.STRICT.encode(cookies);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class Netty4Utils {
|
||||||
public static void setAvailableProcessors(final int availableProcessors) {
|
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
|
// 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"));
|
final boolean set = Booleans.parseBoolean(System.getProperty("es.set.netty.runtime.available.processors", "true"));
|
||||||
if (!set) {
|
if (set == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,11 +75,11 @@ public class Netty4HttpPipeliningHandlerTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void shutdownExecutorService() throws InterruptedException {
|
private void shutdownExecutorService() throws InterruptedException {
|
||||||
if (!handlerService.isShutdown()) {
|
if (handlerService.isShutdown() == false) {
|
||||||
handlerService.shutdown();
|
handlerService.shutdown();
|
||||||
handlerService.awaitTermination(10, TimeUnit.SECONDS);
|
handlerService.awaitTermination(10, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
if (!eventLoopService.isShutdown()) {
|
if (eventLoopService.isShutdown() == false) {
|
||||||
eventLoopService.shutdown();
|
eventLoopService.shutdown();
|
||||||
eventLoopService.awaitTermination(10, TimeUnit.SECONDS);
|
eventLoopService.awaitTermination(10, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class IcuAnalyzerProvider extends AbstractIndexAnalyzerProvider<Analyzer>
|
||||||
super(indexSettings, name, settings);
|
super(indexSettings, name, settings);
|
||||||
String method = settings.get("method", "nfkc_cf");
|
String method = settings.get("method", "nfkc_cf");
|
||||||
String mode = settings.get("mode", "compose");
|
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 +
|
throw new IllegalArgumentException("Unknown mode [" + mode + "] in analyzer [" + name +
|
||||||
"], expected one of [compose, decompose]");
|
"], expected one of [compose, decompose]");
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class IcuNormalizerCharFilterFactory extends AbstractCharFilterFactory im
|
||||||
super(indexSettings, name);
|
super(indexSettings, name);
|
||||||
String method = settings.get("name", "nfkc_cf");
|
String method = settings.get("name", "nfkc_cf");
|
||||||
String mode = settings.get("mode");
|
String mode = settings.get("mode");
|
||||||
if (!"compose".equals(mode) && !"decompose".equals(mode)) {
|
if ("compose".equals(mode) == false && "decompose".equals(mode) == false) {
|
||||||
mode = "compose";
|
mode = "compose";
|
||||||
}
|
}
|
||||||
Normalizer2 normalizer = Normalizer2.getInstance(
|
Normalizer2 normalizer = Normalizer2.getInstance(
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
|
|
||||||
package org.elasticsearch.index.analysis.phonetic;
|
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.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -28,9 +31,6 @@ import java.util.Set;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.commons.codec.EncoderException;
|
|
||||||
import org.apache.commons.codec.StringEncoder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kölner Phonetik
|
* Kölner Phonetik
|
||||||
*
|
*
|
||||||
|
@ -141,14 +141,14 @@ public class KoelnerPhonetik implements StringEncoder {
|
||||||
String primaryForm = str;
|
String primaryForm = str;
|
||||||
List<String> parts = new ArrayList<>();
|
List<String> parts = new ArrayList<>();
|
||||||
parts.add(primaryForm.replaceAll("[^\\p{L}\\p{N}]", ""));
|
parts.add(primaryForm.replaceAll("[^\\p{L}\\p{N}]", ""));
|
||||||
if (!primary) {
|
if (primary == false) {
|
||||||
List<String> tmpParts = new ArrayList<>(Arrays.asList(str.split("[\\p{Z}\\p{C}\\p{P}]")));
|
List<String> tmpParts = new ArrayList<>(Arrays.asList(str.split("[\\p{Z}\\p{C}\\p{P}]")));
|
||||||
int numberOfParts = tmpParts.size();
|
int numberOfParts = tmpParts.size();
|
||||||
while (tmpParts.size() > 0) {
|
while (tmpParts.size() > 0) {
|
||||||
StringBuilder part = new StringBuilder();
|
StringBuilder part = new StringBuilder();
|
||||||
for (int i = 0; i < tmpParts.size(); i++) {
|
for (int i = 0; i < tmpParts.size(); i++) {
|
||||||
part.append(tmpParts.get(i));
|
part.append(tmpParts.get(i));
|
||||||
if (!(i + 1 == numberOfParts)) {
|
if ((i + 1 == numberOfParts) == false) {
|
||||||
parts.add(part.toString());
|
parts.add(part.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ public class AzureSeedHostsProvider implements SeedHostsProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If provided, we check the deployment name
|
// 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...",
|
logger.debug("current deployment name [{}] different from [{}]. skipping...",
|
||||||
deployment.getName(), deploymentName);
|
deployment.getName(), deploymentName);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -121,7 +121,7 @@ class AwsEc2SeedHostsProvider implements SeedHostsProvider {
|
||||||
for (final Reservation reservation : descInstances.getReservations()) {
|
for (final Reservation reservation : descInstances.getReservations()) {
|
||||||
for (final Instance instance : reservation.getInstances()) {
|
for (final Instance instance : reservation.getInstances()) {
|
||||||
// lets see if we can filter based on groups
|
// lets see if we can filter based on groups
|
||||||
if (!groups.isEmpty()) {
|
if (groups.isEmpty() == false) {
|
||||||
final List<GroupIdentifier> instanceSecurityGroups = instance.getSecurityGroups();
|
final List<GroupIdentifier> instanceSecurityGroups = instance.getSecurityGroups();
|
||||||
final List<String> securityGroupNames = new ArrayList<>(instanceSecurityGroups.size());
|
final List<String> securityGroupNames = new ArrayList<>(instanceSecurityGroups.size());
|
||||||
final List<String> securityGroupIds = new ArrayList<>(instanceSecurityGroups.size());
|
final List<String> securityGroupIds = new ArrayList<>(instanceSecurityGroups.size());
|
||||||
|
@ -140,7 +140,7 @@ class AwsEc2SeedHostsProvider implements SeedHostsProvider {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// We need tp match all group names or group ids, otherwise we ignore this instance
|
// 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 {}",
|
logger.trace("filtering out instance {} based on groups {}, does not include all of {}",
|
||||||
instance.getInstanceId(), instanceSecurityGroups, groups);
|
instance.getInstanceId(), instanceSecurityGroups, groups);
|
||||||
// continue to the next instance
|
// continue to the next instance
|
||||||
|
@ -209,7 +209,7 @@ class AwsEc2SeedHostsProvider implements SeedHostsProvider {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!availabilityZones.isEmpty()) {
|
if (availabilityZones.isEmpty() == false) {
|
||||||
// OR relationship amongst multiple values of the availability-zone filter
|
// OR relationship amongst multiple values of the availability-zone filter
|
||||||
describeInstancesRequest.withFilters(
|
describeInstancesRequest.withFilters(
|
||||||
new Filter("availability-zone").withValues(availabilityZones)
|
new Filter("availability-zone").withValues(availabilityZones)
|
||||||
|
|
|
@ -171,7 +171,7 @@ public class GceSeedHostsProvider implements SeedHostsProvider {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (found == false) {
|
||||||
filterByTag = true;
|
filterByTag = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class AzureBlobContainer extends AbstractBlobContainer {
|
||||||
|
|
||||||
private InputStream openInputStream(String blobName, long position, @Nullable Long length) 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");
|
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
|
// 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
|
// exist, instead of returning immediately from the getInputStream call below
|
||||||
// with a 404 StorageException, Azure keeps trying and trying for a long timeout
|
// with a 404 StorageException, Azure keeps trying and trying for a long timeout
|
||||||
|
|
|
@ -64,7 +64,7 @@ final class GoogleCloudStorageHttpStatsCollector implements HttpResponseIntercep
|
||||||
@Override
|
@Override
|
||||||
public void interceptResponse(final HttpResponse response) {
|
public void interceptResponse(final HttpResponse response) {
|
||||||
// TODO keep track of unsuccessful requests in different entries
|
// TODO keep track of unsuccessful requests in different entries
|
||||||
if (!response.isSuccessStatusCode())
|
if (response.isSuccessStatusCode() == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final HttpRequest request = response.getRequest();
|
final HttpRequest request = response.getRequest();
|
||||||
|
|
|
@ -50,7 +50,7 @@ final class HdfsBlobStore implements BlobStore {
|
||||||
this.bufferSize = bufferSize;
|
this.bufferSize = bufferSize;
|
||||||
this.root = execute(fileContext1 -> fileContext1.makeQualified(new Path(path)));
|
this.root = execute(fileContext1 -> fileContext1.makeQualified(new Path(path)));
|
||||||
this.readOnly = readOnly;
|
this.readOnly = readOnly;
|
||||||
if (!readOnly) {
|
if (readOnly == false) {
|
||||||
try {
|
try {
|
||||||
mkdirs(root);
|
mkdirs(root);
|
||||||
} catch (FileAlreadyExistsException ok) {
|
} catch (FileAlreadyExistsException ok) {
|
||||||
|
@ -78,7 +78,7 @@ final class HdfsBlobStore implements BlobStore {
|
||||||
|
|
||||||
private Path buildHdfsPath(BlobPath blobPath) {
|
private Path buildHdfsPath(BlobPath blobPath) {
|
||||||
final Path path = translateToHdfsPath(blobPath);
|
final Path path = translateToHdfsPath(blobPath);
|
||||||
if (!readOnly) {
|
if (readOnly == false) {
|
||||||
try {
|
try {
|
||||||
mkdirs(path);
|
mkdirs(path);
|
||||||
} catch (FileAlreadyExistsException ok) {
|
} catch (FileAlreadyExistsException ok) {
|
||||||
|
|
|
@ -161,7 +161,7 @@ public class NioHttpRequest implements HttpRequest {
|
||||||
String cookieString = request.headers().get(HttpHeaderNames.COOKIE);
|
String cookieString = request.headers().get(HttpHeaderNames.COOKIE);
|
||||||
if (cookieString != null) {
|
if (cookieString != null) {
|
||||||
Set<Cookie> cookies = ServerCookieDecoder.STRICT.decode(cookieString);
|
Set<Cookie> cookies = ServerCookieDecoder.STRICT.decode(cookieString);
|
||||||
if (!cookies.isEmpty()) {
|
if (cookies.isEmpty() == false) {
|
||||||
return ServerCookieEncoder.STRICT.encode(cookies);
|
return ServerCookieEncoder.STRICT.encode(cookies);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,11 +75,11 @@ public class NioHttpPipeliningHandlerTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void shutdownExecutorService() throws InterruptedException {
|
private void shutdownExecutorService() throws InterruptedException {
|
||||||
if (!handlerService.isShutdown()) {
|
if (handlerService.isShutdown() == false) {
|
||||||
handlerService.shutdown();
|
handlerService.shutdown();
|
||||||
handlerService.awaitTermination(10, TimeUnit.SECONDS);
|
handlerService.awaitTermination(10, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
if (!eventLoopService.isShutdown()) {
|
if (eventLoopService.isShutdown() == false) {
|
||||||
eventLoopService.shutdown();
|
eventLoopService.shutdown();
|
||||||
eventLoopService.awaitTermination(10, TimeUnit.SECONDS);
|
eventLoopService.awaitTermination(10, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class SystemCallFilterTests extends ESTestCase {
|
||||||
// otherwise, since we don't have TSYNC support, rules are not applied to the test thread
|
// 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)
|
// (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.
|
// 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 {
|
try {
|
||||||
SystemCallFilter.init(createTempDir());
|
SystemCallFilter.init(createTempDir());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class DelayedShardAggregationBuilder extends AbstractAggregationBuilder<D
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
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;
|
DelayedShardAggregationBuilder that = (DelayedShardAggregationBuilder) o;
|
||||||
return Objects.equals(delay, that.delay);
|
return Objects.equals(delay, that.delay);
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
|
|
||||||
public static void ensureAllArraysAreReleased() throws Exception {
|
public static void ensureAllArraysAreReleased() throws Exception {
|
||||||
final Map<Object, Object> masterCopy = new HashMap<>(ACQUIRED_ARRAYS);
|
final Map<Object, Object> 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
|
// 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
|
// and releasing arrays, lets make sure that after a reasonable timeout, all master
|
||||||
// copy (snapshot) have been released
|
// copy (snapshot) have been released
|
||||||
|
@ -110,7 +110,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
} catch (AssertionError ex) {
|
} catch (AssertionError ex) {
|
||||||
masterCopy.keySet().retainAll(ACQUIRED_ARRAYS.keySet());
|
masterCopy.keySet().retainAll(ACQUIRED_ARRAYS.keySet());
|
||||||
ACQUIRED_ARRAYS.keySet().removeAll(masterCopy.keySet()); // remove all existing master copy we will report on
|
ACQUIRED_ARRAYS.keySet().removeAll(masterCopy.keySet()); // remove all existing master copy we will report on
|
||||||
if (!masterCopy.isEmpty()) {
|
if (masterCopy.isEmpty() == false) {
|
||||||
Iterator<Object> causes = masterCopy.values().iterator();
|
Iterator<Object> causes = masterCopy.values().iterator();
|
||||||
Object firstCause = causes.next();
|
Object firstCause = causes.next();
|
||||||
RuntimeException exception = new RuntimeException(masterCopy.size() + " arrays have not been released",
|
RuntimeException exception = new RuntimeException(masterCopy.size() + " arrays have not been released",
|
||||||
|
@ -170,7 +170,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
@Override
|
@Override
|
||||||
public ByteArray newByteArray(long size, boolean clearOnResize) {
|
public ByteArray newByteArray(long size, boolean clearOnResize) {
|
||||||
final ByteArrayWrapper array = new ByteArrayWrapper(super.newByteArray(size, clearOnResize), clearOnResize);
|
final ByteArrayWrapper array = new ByteArrayWrapper(super.newByteArray(size, clearOnResize), clearOnResize);
|
||||||
if (!clearOnResize) {
|
if (clearOnResize == false) {
|
||||||
array.randomizeContent(0, size);
|
array.randomizeContent(0, size);
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
|
@ -187,7 +187,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
} else {
|
} else {
|
||||||
arr = new ByteArrayWrapper(array, arr.clearOnResize);
|
arr = new ByteArrayWrapper(array, arr.clearOnResize);
|
||||||
}
|
}
|
||||||
if (!arr.clearOnResize) {
|
if (arr.clearOnResize == false) {
|
||||||
arr.randomizeContent(originalSize, size);
|
arr.randomizeContent(originalSize, size);
|
||||||
}
|
}
|
||||||
return arr;
|
return arr;
|
||||||
|
@ -196,7 +196,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
@Override
|
@Override
|
||||||
public IntArray newIntArray(long size, boolean clearOnResize) {
|
public IntArray newIntArray(long size, boolean clearOnResize) {
|
||||||
final IntArrayWrapper array = new IntArrayWrapper(super.newIntArray(size, clearOnResize), clearOnResize);
|
final IntArrayWrapper array = new IntArrayWrapper(super.newIntArray(size, clearOnResize), clearOnResize);
|
||||||
if (!clearOnResize) {
|
if (clearOnResize == false) {
|
||||||
array.randomizeContent(0, size);
|
array.randomizeContent(0, size);
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
|
@ -213,7 +213,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
} else {
|
} else {
|
||||||
arr = new IntArrayWrapper(array, arr.clearOnResize);
|
arr = new IntArrayWrapper(array, arr.clearOnResize);
|
||||||
}
|
}
|
||||||
if (!arr.clearOnResize) {
|
if (arr.clearOnResize == false) {
|
||||||
arr.randomizeContent(originalSize, size);
|
arr.randomizeContent(originalSize, size);
|
||||||
}
|
}
|
||||||
return arr;
|
return arr;
|
||||||
|
@ -222,7 +222,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
@Override
|
@Override
|
||||||
public LongArray newLongArray(long size, boolean clearOnResize) {
|
public LongArray newLongArray(long size, boolean clearOnResize) {
|
||||||
final LongArrayWrapper array = new LongArrayWrapper(super.newLongArray(size, clearOnResize), clearOnResize);
|
final LongArrayWrapper array = new LongArrayWrapper(super.newLongArray(size, clearOnResize), clearOnResize);
|
||||||
if (!clearOnResize) {
|
if (clearOnResize == false) {
|
||||||
array.randomizeContent(0, size);
|
array.randomizeContent(0, size);
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
|
@ -239,7 +239,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
} else {
|
} else {
|
||||||
arr = new LongArrayWrapper(array, arr.clearOnResize);
|
arr = new LongArrayWrapper(array, arr.clearOnResize);
|
||||||
}
|
}
|
||||||
if (!arr.clearOnResize) {
|
if (arr.clearOnResize == false) {
|
||||||
arr.randomizeContent(originalSize, size);
|
arr.randomizeContent(originalSize, size);
|
||||||
}
|
}
|
||||||
return arr;
|
return arr;
|
||||||
|
@ -248,7 +248,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
@Override
|
@Override
|
||||||
public FloatArray newFloatArray(long size, boolean clearOnResize) {
|
public FloatArray newFloatArray(long size, boolean clearOnResize) {
|
||||||
final FloatArrayWrapper array = new FloatArrayWrapper(super.newFloatArray(size, clearOnResize), clearOnResize);
|
final FloatArrayWrapper array = new FloatArrayWrapper(super.newFloatArray(size, clearOnResize), clearOnResize);
|
||||||
if (!clearOnResize) {
|
if (clearOnResize == false) {
|
||||||
array.randomizeContent(0, size);
|
array.randomizeContent(0, size);
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
|
@ -265,7 +265,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
} else {
|
} else {
|
||||||
arr = new FloatArrayWrapper(array, arr.clearOnResize);
|
arr = new FloatArrayWrapper(array, arr.clearOnResize);
|
||||||
}
|
}
|
||||||
if (!arr.clearOnResize) {
|
if (arr.clearOnResize == false) {
|
||||||
arr.randomizeContent(originalSize, size);
|
arr.randomizeContent(originalSize, size);
|
||||||
}
|
}
|
||||||
return arr;
|
return arr;
|
||||||
|
@ -274,7 +274,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
@Override
|
@Override
|
||||||
public DoubleArray newDoubleArray(long size, boolean clearOnResize) {
|
public DoubleArray newDoubleArray(long size, boolean clearOnResize) {
|
||||||
final DoubleArrayWrapper array = new DoubleArrayWrapper(super.newDoubleArray(size, clearOnResize), clearOnResize);
|
final DoubleArrayWrapper array = new DoubleArrayWrapper(super.newDoubleArray(size, clearOnResize), clearOnResize);
|
||||||
if (!clearOnResize) {
|
if (clearOnResize == false) {
|
||||||
array.randomizeContent(0, size);
|
array.randomizeContent(0, size);
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
|
@ -291,7 +291,7 @@ public class MockBigArrays extends BigArrays {
|
||||||
} else {
|
} else {
|
||||||
arr = new DoubleArrayWrapper(array, arr.clearOnResize);
|
arr = new DoubleArrayWrapper(array, arr.clearOnResize);
|
||||||
}
|
}
|
||||||
if (!arr.clearOnResize) {
|
if (arr.clearOnResize == false) {
|
||||||
arr.randomizeContent(originalSize, size);
|
arr.randomizeContent(originalSize, size);
|
||||||
}
|
}
|
||||||
return arr;
|
return arr;
|
||||||
|
|
|
@ -41,16 +41,16 @@ public class MockPageCacheRecycler extends PageCacheRecycler {
|
||||||
|
|
||||||
public static void ensureAllPagesAreReleased() throws Exception {
|
public static void ensureAllPagesAreReleased() throws Exception {
|
||||||
final Map<Object, Throwable> masterCopy = new HashMap<>(ACQUIRED_PAGES);
|
final Map<Object, Throwable> 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
|
// 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
|
// and releasing pages, lets make sure that after a reasonable timeout, all master
|
||||||
// copy (snapshot) have been released
|
// copy (snapshot) have been released
|
||||||
final boolean success =
|
final boolean success =
|
||||||
waitUntil(() -> Sets.haveEmptyIntersection(masterCopy.keySet(), ACQUIRED_PAGES.keySet()));
|
waitUntil(() -> Sets.haveEmptyIntersection(masterCopy.keySet(), ACQUIRED_PAGES.keySet()));
|
||||||
if (!success) {
|
if (success == false) {
|
||||||
masterCopy.keySet().retainAll(ACQUIRED_PAGES.keySet());
|
masterCopy.keySet().retainAll(ACQUIRED_PAGES.keySet());
|
||||||
ACQUIRED_PAGES.keySet().removeAll(masterCopy.keySet()); // remove all existing master copy we will report on
|
ACQUIRED_PAGES.keySet().removeAll(masterCopy.keySet()); // remove all existing master copy we will report on
|
||||||
if (!masterCopy.isEmpty()) {
|
if (masterCopy.isEmpty() == false) {
|
||||||
Iterator<Throwable> causes = masterCopy.values().iterator();
|
Iterator<Throwable> causes = masterCopy.values().iterator();
|
||||||
Throwable firstCause = causes.next();
|
Throwable firstCause = causes.next();
|
||||||
RuntimeException exception = new RuntimeException(masterCopy.size() + " pages have not been released", firstCause);
|
RuntimeException exception = new RuntimeException(masterCopy.size() + " pages have not been released", firstCause);
|
||||||
|
@ -120,7 +120,7 @@ public class MockPageCacheRecycler extends PageCacheRecycler {
|
||||||
@Override
|
@Override
|
||||||
public V<byte[]> bytePage(boolean clear) {
|
public V<byte[]> bytePage(boolean clear) {
|
||||||
final V<byte[]> page = super.bytePage(clear);
|
final V<byte[]> page = super.bytePage(clear);
|
||||||
if (!clear) {
|
if (clear == false) {
|
||||||
Arrays.fill(page.v(), 0, page.v().length, (byte)random.nextInt(1<<8));
|
Arrays.fill(page.v(), 0, page.v().length, (byte)random.nextInt(1<<8));
|
||||||
}
|
}
|
||||||
return wrap(page);
|
return wrap(page);
|
||||||
|
@ -129,7 +129,7 @@ public class MockPageCacheRecycler extends PageCacheRecycler {
|
||||||
@Override
|
@Override
|
||||||
public V<int[]> intPage(boolean clear) {
|
public V<int[]> intPage(boolean clear) {
|
||||||
final V<int[]> page = super.intPage(clear);
|
final V<int[]> page = super.intPage(clear);
|
||||||
if (!clear) {
|
if (clear == false) {
|
||||||
Arrays.fill(page.v(), 0, page.v().length, random.nextInt());
|
Arrays.fill(page.v(), 0, page.v().length, random.nextInt());
|
||||||
}
|
}
|
||||||
return wrap(page);
|
return wrap(page);
|
||||||
|
@ -138,7 +138,7 @@ public class MockPageCacheRecycler extends PageCacheRecycler {
|
||||||
@Override
|
@Override
|
||||||
public V<long[]> longPage(boolean clear) {
|
public V<long[]> longPage(boolean clear) {
|
||||||
final V<long[]> page = super.longPage(clear);
|
final V<long[]> page = super.longPage(clear);
|
||||||
if (!clear) {
|
if (clear == false) {
|
||||||
Arrays.fill(page.v(), 0, page.v().length, random.nextLong());
|
Arrays.fill(page.v(), 0, page.v().length, random.nextLong());
|
||||||
}
|
}
|
||||||
return wrap(page);
|
return wrap(page);
|
||||||
|
|
|
@ -134,13 +134,13 @@ public class BackgroundIndexer implements AutoCloseable {
|
||||||
try {
|
try {
|
||||||
startLatch.await();
|
startLatch.await();
|
||||||
logger.info("**** starting indexing thread {}", indexerId);
|
logger.info("**** starting indexing thread {}", indexerId);
|
||||||
while (!stop.get()) {
|
while (stop.get() == false) {
|
||||||
if (batch) {
|
if (batch) {
|
||||||
int batchSize = threadRandom.nextInt(20) + 1;
|
int batchSize = threadRandom.nextInt(20) + 1;
|
||||||
if (hasBudget.get()) {
|
if (hasBudget.get()) {
|
||||||
// always try to get at least one
|
// always try to get at least one
|
||||||
batchSize = Math.max(Math.min(batchSize, availableBudget.availablePermits()), 1);
|
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.
|
// time out -> check if we have to stop.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ public class BackgroundIndexer implements AutoCloseable {
|
||||||
}
|
}
|
||||||
} else {
|
} 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.
|
// time out -> check if we have to stop.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ public class BackgroundIndexer implements AutoCloseable {
|
||||||
* @param numOfDocs number of document to index before pausing. Set to -1 to have no limit.
|
* @param numOfDocs number of document to index before pausing. Set to -1 to have no limit.
|
||||||
*/
|
*/
|
||||||
public void start(int numOfDocs) {
|
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);
|
setBudget(numOfDocs);
|
||||||
startLatch.countDown();
|
startLatch.countDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -517,7 +517,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void clearClusters() throws Exception {
|
private static void clearClusters() throws Exception {
|
||||||
if (!clusters.isEmpty()) {
|
if (clusters.isEmpty() == false) {
|
||||||
IOUtils.close(clusters.values());
|
IOUtils.close(clusters.values());
|
||||||
clusters.clear();
|
clusters.clear();
|
||||||
}
|
}
|
||||||
|
@ -568,7 +568,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
|
||||||
}
|
}
|
||||||
success = true;
|
success = true;
|
||||||
} finally {
|
} finally {
|
||||||
if (!success) {
|
if (success == false) {
|
||||||
// if we failed here that means that something broke horribly so we should clear all clusters
|
// 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
|
// TODO: just let the exception happen, WTF is all this horseshit
|
||||||
// afterTestRule.forceFailure();
|
// afterTestRule.forceFailure();
|
||||||
|
@ -596,7 +596,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InternalTestCluster internalCluster() {
|
public static InternalTestCluster internalCluster() {
|
||||||
if (!isInternalCluster()) {
|
if (isInternalCluster() == false) {
|
||||||
throw new UnsupportedOperationException("current test cluster is immutable");
|
throw new UnsupportedOperationException("current test cluster is immutable");
|
||||||
}
|
}
|
||||||
return (InternalTestCluster) currentCluster;
|
return (InternalTestCluster) currentCluster;
|
||||||
|
@ -727,7 +727,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
|
||||||
created.add(name);
|
created.add(name);
|
||||||
success = true;
|
success = true;
|
||||||
} finally {
|
} finally {
|
||||||
if (!success && !created.isEmpty()) {
|
if (success == false && created.isEmpty() == false) {
|
||||||
cluster().wipeIndices(created.toArray(new String[created.size()]));
|
cluster().wipeIndices(created.toArray(new String[created.size()]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -841,7 +841,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
|
||||||
getExcludeSettings(n, builder);
|
getExcludeSettings(n, builder);
|
||||||
}
|
}
|
||||||
Settings build = builder.build();
|
Settings build = builder.build();
|
||||||
if (!build.isEmpty()) {
|
if (build.isEmpty() == false) {
|
||||||
logger.debug("allowNodes: updating [{}]'s setting to [{}]", index, build.toDelimitedString(';'));
|
logger.debug("allowNodes: updating [{}]'s setting to [{}]", index, build.toDelimitedString(';'));
|
||||||
client().admin().indices().prepareUpdateSettings(index).setSettings(build).execute().actionGet();
|
client().admin().indices().prepareUpdateSettings(index).setSettings(build).execute().actionGet();
|
||||||
}
|
}
|
||||||
|
@ -1427,7 +1427,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
|
||||||
indices.add(builder.request().index());
|
indices.add(builder.request().index());
|
||||||
}
|
}
|
||||||
Set<List<String>> bogusIds = new HashSet<>(); // (index, type, id)
|
Set<List<String>> bogusIds = new HashSet<>(); // (index, type, id)
|
||||||
if (random.nextBoolean() && !builders.isEmpty() && dummyDocuments) {
|
if (random.nextBoolean() && builders.isEmpty() == false && dummyDocuments) {
|
||||||
builders = new ArrayList<>(builders);
|
builders = new ArrayList<>(builders);
|
||||||
// inject some bogus docs
|
// inject some bogus docs
|
||||||
final int numBogusDocs = scaledRandomIntBetween(1, builders.size() * 2);
|
final int numBogusDocs = scaledRandomIntBetween(1, builders.size() * 2);
|
||||||
|
@ -1489,7 +1489,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertThat(actualErrors, emptyIterable());
|
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!
|
// delete the bogus types again - it might trigger merges or at least holes in the segments and enforces deleted docs!
|
||||||
for (List<String> doc : bogusIds) {
|
for (List<String> doc : bogusIds) {
|
||||||
assertEquals("failed to delete a dummy doc [" + doc.get(0) + "][" + doc.get(1) + "]",
|
assertEquals("failed to delete a dummy doc [" + doc.get(0) + "][" + doc.get(1) + "]",
|
||||||
|
@ -2121,7 +2121,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
|
||||||
INSTANCE.setupSuiteScopeCluster();
|
INSTANCE.setupSuiteScopeCluster();
|
||||||
success = true;
|
success = true;
|
||||||
} finally {
|
} finally {
|
||||||
if (!success) {
|
if (success == false) {
|
||||||
afterClass();
|
afterClass();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -540,7 +540,7 @@ public final class InternalTestCluster extends TestCluster {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensureOpen() {
|
private void ensureOpen() {
|
||||||
if (!open.get()) {
|
if (open.get() == false) {
|
||||||
throw new RuntimeException("Cluster is already closed");
|
throw new RuntimeException("Cluster is already closed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -623,7 +623,7 @@ public final class InternalTestCluster extends TestCluster {
|
||||||
}
|
}
|
||||||
|
|
||||||
stopNodesAndClients(nodesToRemove);
|
stopNodesAndClients(nodesToRemove);
|
||||||
if (!nodesToRemove.isEmpty() && size() > 0) {
|
if (nodesToRemove.isEmpty() == false && size() > 0) {
|
||||||
validateClusterFormed();
|
validateClusterFormed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1394,7 +1394,7 @@ public final class InternalTestCluster extends TestCluster {
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void wipePendingDataDirectories() {
|
public synchronized void wipePendingDataDirectories() {
|
||||||
if (!dataDirToClean.isEmpty()) {
|
if (dataDirToClean.isEmpty() == false) {
|
||||||
try {
|
try {
|
||||||
for (Path path : dataDirToClean) {
|
for (Path path : dataDirToClean) {
|
||||||
try {
|
try {
|
||||||
|
@ -2063,7 +2063,7 @@ public final class InternalTestCluster extends TestCluster {
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void publishNode(NodeAndClient nodeAndClient) {
|
private synchronized void publishNode(NodeAndClient nodeAndClient) {
|
||||||
assert !nodeAndClient.node().isClosed();
|
assert nodeAndClient.node().isClosed() == false;
|
||||||
final NavigableMap<String, NodeAndClient> newNodes = new TreeMap<>(nodes);
|
final NavigableMap<String, NodeAndClient> newNodes = new TreeMap<>(nodes);
|
||||||
newNodes.put(nodeAndClient.name, nodeAndClient);
|
newNodes.put(nodeAndClient.name, nodeAndClient);
|
||||||
nodes = Collections.unmodifiableNavigableMap(newNodes);
|
nodes = Collections.unmodifiableNavigableMap(newNodes);
|
||||||
|
|
|
@ -148,7 +148,7 @@ public abstract class TestCluster implements Closeable {
|
||||||
for (IndexMetadata indexMetadata : clusterStateResponse.getState().metadata()) {
|
for (IndexMetadata indexMetadata : clusterStateResponse.getState().metadata()) {
|
||||||
concreteIndices.add(indexMetadata.getIndex().getName());
|
concreteIndices.add(indexMetadata.getIndex().getName());
|
||||||
}
|
}
|
||||||
if (!concreteIndices.isEmpty()) {
|
if (concreteIndices.isEmpty() == false) {
|
||||||
assertAcked(client().admin().indices().prepareDelete(concreteIndices.toArray(String.class)));
|
assertAcked(client().admin().indices().prepareDelete(concreteIndices.toArray(String.class)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,11 +45,15 @@ public abstract class TestCustomMetadata extends AbstractNamedDiffable<Metadata.
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
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;
|
TestCustomMetadata that = (TestCustomMetadata) o;
|
||||||
|
|
||||||
if (!data.equals(that.data)) return false;
|
if (data.equals(that.data) == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue