Remove unnecessary warning supressions (#32250)
This commit is contained in:
parent
4b3284f7cb
commit
ff87b7aba4
|
@ -21,6 +21,7 @@ package org.elasticsearch.transport.client;
|
|||
|
||||
import io.netty.util.ThreadDeathWatcher;
|
||||
import io.netty.util.concurrent.GlobalEventExecutor;
|
||||
|
||||
import org.elasticsearch.client.transport.TransportClient;
|
||||
import org.elasticsearch.common.SuppressForbidden;
|
||||
import org.elasticsearch.common.network.NetworkModule;
|
||||
|
|
|
@ -137,7 +137,6 @@ public class ChannelFactoryTests extends ESTestCase {
|
|||
super(rawChannelFactory);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public NioSocketChannel createChannel(NioSelector selector, SocketChannel channel) throws IOException {
|
||||
NioSocketChannel nioSocketChannel = new NioSocketChannel(channel);
|
||||
|
|
|
@ -120,7 +120,6 @@ public class EventHandlerTests extends ESTestCase {
|
|||
verify(channelFactory, times(2)).acceptNioChannel(same(serverContext), same(selectorSupplier));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testHandleAcceptCallsServerAcceptCallback() throws IOException {
|
||||
NioSocketChannel childChannel = new NioSocketChannel(mock(SocketChannel.class));
|
||||
SocketChannelContext childContext = mock(SocketChannelContext.class);
|
||||
|
|
|
@ -275,7 +275,6 @@ public class SocketChannelContextTests extends ESTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testCloseClosesChannelBuffer() throws IOException {
|
||||
try (SocketChannel realChannel = SocketChannel.open()) {
|
||||
when(channel.getRawChannel()).thenReturn(realChannel);
|
||||
|
|
|
@ -43,7 +43,6 @@ class MultiPassStats {
|
|||
this.fieldBKey = fieldBName;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
void computeStats(final List<Double> fieldA, final List<Double> fieldB) {
|
||||
// set count
|
||||
count = fieldA.size();
|
||||
|
|
|
@ -146,7 +146,6 @@ public class JsonProcessorTests extends ESTestCase {
|
|||
assertThat(exception.getMessage(), equalTo("field [field] not present as part of path [field]"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testAddToRoot() throws Exception {
|
||||
String processorTag = randomAlphaOfLength(3);
|
||||
String randomTargetField = randomAlphaOfLength(2);
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Map;
|
|||
|
||||
public class InitializerTests extends ScriptTestCase {
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public void testArrayInitializers() {
|
||||
int[] ints = (int[])exec("new int[] {}");
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class InitializerTests extends ScriptTestCase {
|
|||
assertEquals("aaaaaa", objects[3]);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public void testListInitializers() {
|
||||
List list = (List)exec("[]");
|
||||
|
||||
|
@ -91,7 +91,7 @@ public class InitializerTests extends ScriptTestCase {
|
|||
assertEquals("aaaaaa", list.get(3));
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public void testMapInitializers() {
|
||||
Map map = (Map)exec("[:]");
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@ public class RestUpdateByQueryAction extends AbstractBulkByQueryRestHandler<Upda
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected UpdateByQueryRequest buildRequest(RestRequest request) throws IOException {
|
||||
/*
|
||||
* Passing the search request through UpdateByQueryRequest first allows
|
||||
|
|
|
@ -90,7 +90,6 @@ public class SimpleNetty4TransportTests extends AbstractSimpleTransportTestCase
|
|||
@Override
|
||||
protected void closeConnectionChannel(Transport transport, Transport.Connection connection) throws IOException {
|
||||
final Netty4Transport t = (Netty4Transport) transport;
|
||||
@SuppressWarnings("unchecked")
|
||||
final TcpTransport.NodeChannels channels = (TcpTransport.NodeChannels) connection;
|
||||
CloseableChannel.closeChannels(channels.getChannels().subList(0, randomIntBetween(1, channels.getChannels().size())), true);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import io.netty.handler.codec.http.HttpResponseDecoder;
|
|||
import io.netty.handler.codec.http.HttpResponseStatus;
|
||||
import io.netty.handler.codec.http.HttpUtil;
|
||||
import io.netty.handler.codec.http.HttpVersion;
|
||||
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
|
@ -89,7 +90,6 @@ public class HttpReadWriteHandlerTests extends ESTestCase {
|
|||
private final ResponseDecoder responseDecoder = new ResponseDecoder();
|
||||
|
||||
@Before
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setMocks() {
|
||||
transport = mock(NioHttpServerTransport.class);
|
||||
Settings settings = Settings.EMPTY;
|
||||
|
|
|
@ -95,7 +95,6 @@ public class SimpleNioTransportTests extends AbstractSimpleTransportTestCase {
|
|||
|
||||
@Override
|
||||
protected void closeConnectionChannel(Transport transport, Transport.Connection connection) throws IOException {
|
||||
@SuppressWarnings("unchecked")
|
||||
TcpTransport.NodeChannels channels = (TcpTransport.NodeChannels) connection;
|
||||
CloseableChannel.closeChannels(channels.getChannels().subList(0, randomIntBetween(1, channels.getChannels().size())), true);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,6 @@ public class ClusterGetSettingsResponse extends ActionResponse implements ToXCon
|
|||
static final String TRANSIENT_FIELD = "transient";
|
||||
static final String DEFAULTS_FIELD = "defaults";
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static final ConstructingObjectParser<ClusterGetSettingsResponse, Void> PARSER =
|
||||
new ConstructingObjectParser<>(
|
||||
"cluster_get_settings_response",
|
||||
|
|
|
@ -45,7 +45,6 @@ public class QueryExplanation implements Streamable, ToXContentFragment {
|
|||
|
||||
public static final int RANDOM_SHARD = -1;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static ConstructingObjectParser<QueryExplanation, Void> PARSER = new ConstructingObjectParser<>(
|
||||
"query_explanation",
|
||||
true,
|
||||
|
|
|
@ -129,7 +129,6 @@ public class GetResponse extends ActionResponse implements Iterable<DocumentFiel
|
|||
/**
|
||||
* The source of the document (As a map).
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public Map<String, Object> getSourceAsMap() throws ElasticsearchParseException {
|
||||
return getResult.sourceAsMap();
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@ import org.elasticsearch.ingest.IngestDocument;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg;
|
||||
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.constructorArg;
|
||||
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg;
|
||||
|
||||
public class SimulateProcessorResult implements Writeable, ToXContentObject {
|
||||
|
||||
|
@ -42,7 +42,6 @@ public class SimulateProcessorResult implements Writeable, ToXContentObject {
|
|||
private final WriteableIngestDocument ingestDocument;
|
||||
private final Exception failure;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static final ConstructingObjectParser<ElasticsearchException, Void> IGNORED_ERROR_PARSER =
|
||||
new ConstructingObjectParser<>(
|
||||
"ignored_error_parser",
|
||||
|
@ -57,7 +56,6 @@ public class SimulateProcessorResult implements Writeable, ToXContentObject {
|
|||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final ConstructingObjectParser<SimulateProcessorResult, Void> PARSER =
|
||||
new ConstructingObjectParser<>(
|
||||
"simulate_processor_result",
|
||||
|
|
|
@ -94,7 +94,6 @@ final class WriteableIngestDocument implements Writeable, ToXContentFragment {
|
|||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final ConstructingObjectParser<WriteableIngestDocument, Void> PARSER =
|
||||
new ConstructingObjectParser<>(
|
||||
"writeable_ingest_document",
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.elasticsearch.action.support;
|
||||
|
||||
import com.carrotsearch.hppc.cursors.IntObjectCursor;
|
||||
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||
import org.elasticsearch.cluster.routing.IndexRoutingTable;
|
||||
|
@ -205,7 +206,7 @@ public final class ActiveShardCount implements Writeable {
|
|||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings("unchecked") ActiveShardCount that = (ActiveShardCount) o;
|
||||
ActiveShardCount that = (ActiveShardCount) o;
|
||||
return value == that.value;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,6 @@ public abstract class ReplicationRequestBuilder<Request extends ReplicationReque
|
|||
* shard count is passed in, instead of having to first call {@link ActiveShardCount#from(int)}
|
||||
* to get the ActiveShardCount.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public RequestBuilder setWaitForActiveShards(final int waitForActiveShards) {
|
||||
return setWaitForActiveShards(ActiveShardCount.from(waitForActiveShards));
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.elasticsearch.cluster;
|
||||
|
||||
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
||||
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.cluster.ClusterState.Custom;
|
||||
import org.elasticsearch.common.collect.ImmutableOpenMap;
|
||||
|
@ -165,7 +166,7 @@ public class RestoreInProgress extends AbstractNamedDiffable<Custom> implements
|
|||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings("unchecked") Entry entry = (Entry) o;
|
||||
Entry entry = (Entry) o;
|
||||
return snapshot.equals(entry.snapshot) &&
|
||||
state == entry.state &&
|
||||
indices.equals(entry.indices) &&
|
||||
|
@ -291,7 +292,7 @@ public class RestoreInProgress extends AbstractNamedDiffable<Custom> implements
|
|||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked") ShardRestoreStatus status = (ShardRestoreStatus) o;
|
||||
ShardRestoreStatus status = (ShardRestoreStatus) o;
|
||||
return state == status.state &&
|
||||
Objects.equals(nodeId, status.nodeId) &&
|
||||
Objects.equals(reason, status.reason);
|
||||
|
|
|
@ -161,7 +161,6 @@ public final class IndexGraveyard implements MetaData.Custom {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Diff<MetaData.Custom> diff(final MetaData.Custom previous) {
|
||||
return new IndexGraveyardDiff((IndexGraveyard) previous, this);
|
||||
}
|
||||
|
@ -321,7 +320,7 @@ public final class IndexGraveyard implements MetaData.Custom {
|
|||
|
||||
@Override
|
||||
public IndexGraveyard apply(final MetaData.Custom previous) {
|
||||
@SuppressWarnings("unchecked") final IndexGraveyard old = (IndexGraveyard) previous;
|
||||
final IndexGraveyard old = (IndexGraveyard) previous;
|
||||
if (removedCount > old.tombstones.size()) {
|
||||
throw new IllegalStateException("IndexGraveyardDiff cannot remove [" + removedCount + "] entries from [" +
|
||||
old.tombstones.size() + "] tombstones.");
|
||||
|
@ -416,7 +415,7 @@ public final class IndexGraveyard implements MetaData.Custom {
|
|||
if (other == null || getClass() != other.getClass()) {
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings("unchecked") Tombstone that = (Tombstone) other;
|
||||
Tombstone that = (Tombstone) other;
|
||||
return index.equals(that.index) && deleteDateInMillis == that.deleteDateInMillis;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.carrotsearch.hppc.LongArrayList;
|
|||
import com.carrotsearch.hppc.cursors.IntObjectCursor;
|
||||
import com.carrotsearch.hppc.cursors.ObjectCursor;
|
||||
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
||||
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.action.admin.indices.rollover.RolloverInfo;
|
||||
import org.elasticsearch.action.support.ActiveShardCount;
|
||||
|
@ -685,7 +686,6 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
|||
return lookupPrototypeSafe(key).readFrom(in);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Diff<Custom> readDiff(StreamInput in, String key) throws IOException {
|
||||
return lookupPrototypeSafe(key).readDiffFrom(in);
|
||||
|
|
|
@ -381,7 +381,6 @@ public class IndexTemplateMetaData extends AbstractDiffable<IndexTemplateMetaDat
|
|||
aliases.build(), customs.build());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void toXContent(IndexTemplateMetaData indexTemplateMetaData, XContentBuilder builder, ToXContent.Params params)
|
||||
throws IOException {
|
||||
builder.startObject(indexTemplateMetaData.name());
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.elasticsearch.cluster.metadata;
|
|||
import com.carrotsearch.hppc.ObjectHashSet;
|
||||
import com.carrotsearch.hppc.cursors.ObjectCursor;
|
||||
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.lucene.util.CollectionUtil;
|
||||
import org.elasticsearch.action.AliasesRequest;
|
||||
|
@ -169,7 +170,6 @@ public class MetaData implements Iterable<IndexMetaData>, Diffable<MetaData>, To
|
|||
|
||||
private final SortedMap<String, AliasOrIndex> aliasAndIndexLookup;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
MetaData(String clusterUUID, long version, Settings transientSettings, Settings persistentSettings,
|
||||
ImmutableOpenMap<String, IndexMetaData> indices, ImmutableOpenMap<String, IndexTemplateMetaData> templates,
|
||||
ImmutableOpenMap<String, Custom> customs, String[] allIndices, String[] allOpenIndices, String[] allClosedIndices,
|
||||
|
@ -1000,7 +1000,7 @@ public class MetaData implements Iterable<IndexMetaData>, Diffable<MetaData>, To
|
|||
}
|
||||
|
||||
public IndexGraveyard indexGraveyard() {
|
||||
@SuppressWarnings("unchecked") IndexGraveyard graveyard = (IndexGraveyard) getCustom(IndexGraveyard.TYPE);
|
||||
IndexGraveyard graveyard = (IndexGraveyard) getCustom(IndexGraveyard.TYPE);
|
||||
return graveyard;
|
||||
}
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ public abstract class RecoverySource implements Writeable, ToXContentObject {
|
|||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked") SnapshotRecoverySource that = (SnapshotRecoverySource) o;
|
||||
SnapshotRecoverySource that = (SnapshotRecoverySource) o;
|
||||
return snapshot.equals(that.snapshot) && index.equals(that.index) && version.equals(that.version);
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ public abstract class AbstractAllocationDecision implements ToXContentFragment,
|
|||
if (other == null || other instanceof AbstractAllocationDecision == false) {
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings("unchecked") AbstractAllocationDecision that = (AbstractAllocationDecision) other;
|
||||
AbstractAllocationDecision that = (AbstractAllocationDecision) other;
|
||||
return Objects.equals(targetNode, that.targetNode) && Objects.equals(nodeDecisions, that.nodeDecisions);
|
||||
}
|
||||
|
||||
|
|
|
@ -316,7 +316,7 @@ public class AllocateUnassignedDecision extends AbstractAllocationDecision {
|
|||
if (other instanceof AllocateUnassignedDecision == false) {
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings("unchecked") AllocateUnassignedDecision that = (AllocateUnassignedDecision) other;
|
||||
AllocateUnassignedDecision that = (AllocateUnassignedDecision) other;
|
||||
return Objects.equals(allocationStatus, that.allocationStatus)
|
||||
&& Objects.equals(allocationId, that.allocationId)
|
||||
&& reuseStore == that.reuseStore
|
||||
|
|
|
@ -300,7 +300,7 @@ public final class MoveDecision extends AbstractAllocationDecision {
|
|||
if (other instanceof MoveDecision == false) {
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings("unchecked") MoveDecision that = (MoveDecision) other;
|
||||
MoveDecision that = (MoveDecision) other;
|
||||
return Objects.equals(allocationDecision, that.allocationDecision)
|
||||
&& Objects.equals(canRemainDecision, that.canRemainDecision)
|
||||
&& Objects.equals(clusterRebalanceDecision, that.clusterRebalanceDecision)
|
||||
|
|
|
@ -54,7 +54,6 @@ public abstract class AbstractLifecycleComponent extends AbstractComponent imple
|
|||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
public void start() {
|
||||
if (!lifecycle.canMoveToStarted()) {
|
||||
|
@ -72,7 +71,6 @@ public abstract class AbstractLifecycleComponent extends AbstractComponent imple
|
|||
|
||||
protected abstract void doStart();
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
public void stop() {
|
||||
if (!lifecycle.canMoveToStopped()) {
|
||||
|
|
|
@ -32,7 +32,6 @@ class ConstructorInjectorStore {
|
|||
private final FailableCache<TypeLiteral<?>, ConstructorInjector<?>> cache
|
||||
= new FailableCache<TypeLiteral<?>, ConstructorInjector<?>>() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected ConstructorInjector<?> create(TypeLiteral<?> type, Errors errors)
|
||||
throws ErrorsException {
|
||||
return createConstructor(type, errors);
|
||||
|
|
|
@ -101,7 +101,6 @@ class TypeConverterBindingProcessor extends AbstractProcessor {
|
|||
},
|
||||
new TypeConverter() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object convert(String value, TypeLiteral<?> toType) {
|
||||
try {
|
||||
return Class.forName(value);
|
||||
|
@ -128,7 +127,6 @@ class TypeConverterBindingProcessor extends AbstractProcessor {
|
|||
|
||||
TypeConverter typeConverter = new TypeConverter() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object convert(String value, TypeLiteral<?> toType) {
|
||||
try {
|
||||
return parser.invoke(null, value);
|
||||
|
|
|
@ -42,7 +42,6 @@ class AssistedConstructor<T> {
|
|||
private final ParameterListKey assistedParameters;
|
||||
private final List<Parameter> allParameters;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
AssistedConstructor(Constructor<T> constructor, List<TypeLiteral<?>> parameterTypes) {
|
||||
this.constructor = constructor;
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ public class ProviderMethod<T> implements ProviderWithDependencies<T> {
|
|||
|
||||
try {
|
||||
// We know this cast is safe because T is the method's return type.
|
||||
@SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
T result = (T) method.invoke(instance, parameters);
|
||||
return result;
|
||||
} catch (IllegalAccessException e) {
|
||||
|
|
|
@ -220,7 +220,6 @@ public abstract class Multibinder<T> {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void configure(Binder binder) {
|
||||
checkConfiguration(!isInitialized(), "Multibinder was already initialized");
|
||||
|
||||
|
|
|
@ -78,8 +78,7 @@ public abstract class DefaultBindingTargetVisitor<T, V> implements BindingTarget
|
|||
|
||||
// javac says it's an error to cast ProviderBinding<? extends T> to Binding<? extends T>
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public V visit(ProviderBinding<? extends T> providerBinding) {
|
||||
return visitOther((Binding<? extends T>) providerBinding);
|
||||
return visitOther(providerBinding);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -518,7 +518,6 @@ public abstract class StreamInput extends InputStream {
|
|||
return (Map<String, Object>) readGenericValue();
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Nullable
|
||||
public Object readGenericValue() throws IOException {
|
||||
byte type = readByte();
|
||||
|
|
|
@ -178,7 +178,6 @@ public class GetResult implements Streamable, Iterable<DocumentField>, ToXConten
|
|||
/**
|
||||
* The source of the document (As a map).
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public Map<String, Object> sourceAsMap() throws ElasticsearchParseException {
|
||||
if (source == null) {
|
||||
return null;
|
||||
|
|
|
@ -197,7 +197,6 @@ public class DocumentMapper implements ToXContentFragment {
|
|||
return mapping.root;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public <T extends MetadataFieldMapper> T metadataMapper(Class<T> type) {
|
||||
return mapping.metadataMapper(type);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ public class NodePersistentTasksExecutor {
|
|||
task.markAsFailed(e);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected void doRun() throws Exception {
|
||||
try {
|
||||
|
|
|
@ -85,7 +85,6 @@ public class PersistentTasksClusterService extends AbstractComponent implements
|
|||
listener.onFailure(e);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
|
||||
PersistentTasksCustomMetaData tasks = newState.getMetaData().custom(PersistentTasksCustomMetaData.TYPE);
|
||||
|
|
|
@ -33,7 +33,6 @@ public class PersistentTasksExecutorRegistry extends AbstractComponent {
|
|||
|
||||
private final Map<String, PersistentTasksExecutor<?>> taskExecutors;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public PersistentTasksExecutorRegistry(Settings settings, Collection<PersistentTasksExecutor<?>> taskExecutors) {
|
||||
super(settings);
|
||||
Map<String, PersistentTasksExecutor<?>> map = new HashMap<>();
|
||||
|
|
|
@ -89,7 +89,7 @@ public final class IndexId implements Writeable, ToXContentObject {
|
|||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings("unchecked") IndexId that = (IndexId) o;
|
||||
IndexId that = (IndexId) o;
|
||||
return Objects.equals(name, that.name) && Objects.equals(id, that.id);
|
||||
}
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ public final class RepositoryData {
|
|||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings("unchecked") RepositoryData that = (RepositoryData) obj;
|
||||
RepositoryData that = (RepositoryData) obj;
|
||||
return snapshotIds.equals(that.snapshotIds)
|
||||
&& snapshotStates.equals(that.snapshotStates)
|
||||
&& indices.equals(that.indices)
|
||||
|
|
|
@ -247,7 +247,6 @@ public class InternalComposite
|
|||
this.formats = formats;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
InternalBucket(StreamInput in, List<String> sourceNames, List<DocValueFormat> formats, int[] reverseMuls) throws IOException {
|
||||
this.key = new CompositeKey(in);
|
||||
this.docCount = in.readVLong();
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.common.ParseField;
|
|||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.common.xcontent.ToXContent.Params;
|
||||
import org.elasticsearch.common.xcontent.ToXContentObject;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
@ -358,7 +357,6 @@ public class RangeAggregator extends BucketsAggregator {
|
|||
private final InternalRange.Factory factory;
|
||||
private final DocValueFormat format;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Unmapped(String name, R[] ranges, boolean keyed, DocValueFormat format,
|
||||
SearchContext context,
|
||||
Aggregator parent, InternalRange.Factory factory, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData)
|
||||
|
|
|
@ -62,7 +62,6 @@ public class MovFnPipelineAggregationBuilder extends AbstractPipelineAggregation
|
|||
private static final Function<String, ConstructingObjectParser<MovFnPipelineAggregationBuilder, Void>> PARSER
|
||||
= name -> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ConstructingObjectParser<MovFnPipelineAggregationBuilder, Void> parser = new ConstructingObjectParser<>(
|
||||
MovFnPipelineAggregationBuilder.NAME,
|
||||
false,
|
||||
|
|
|
@ -54,7 +54,6 @@ public class ValuesSourceConfig<VS extends ValuesSource> {
|
|||
|
||||
if (field == null) {
|
||||
if (script == null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
ValuesSourceConfig<VS> config = new ValuesSourceConfig<>(ValuesSourceType.ANY);
|
||||
config.format(resolveFormat(null, valueType));
|
||||
return config;
|
||||
|
|
|
@ -90,7 +90,6 @@ public class GeoDistanceSortBuilder extends SortBuilder<GeoDistanceSortBuilder>
|
|||
private DistanceUnit unit = DistanceUnit.DEFAULT;
|
||||
|
||||
private SortMode sortMode = null;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private QueryBuilder nestedFilter;
|
||||
private String nestedPath;
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ public final class Snapshot implements Writeable {
|
|||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings("unchecked") Snapshot that = (Snapshot) o;
|
||||
Snapshot that = (Snapshot) o;
|
||||
return repository.equals(that.repository) && snapshotId.equals(that.snapshotId);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.elasticsearch.snapshots;
|
|||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.common.xcontent.ToXContent.Params;
|
||||
import org.elasticsearch.common.xcontent.ToXContentObject;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
|
@ -98,7 +97,7 @@ public final class SnapshotId implements Comparable<SnapshotId>, Writeable, ToXC
|
|||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
@SuppressWarnings("unchecked") final SnapshotId that = (SnapshotId) o;
|
||||
final SnapshotId that = (SnapshotId) o;
|
||||
return name.equals(that.name) && uuid.equals(that.uuid);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.threadpool;
|
|||
|
||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
import org.apache.lucene.util.Counter;
|
||||
import org.elasticsearch.core.internal.io.IOUtils;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
|
@ -38,6 +37,7 @@ import org.elasticsearch.common.util.concurrent.ThreadContext;
|
|||
import org.elasticsearch.common.util.concurrent.XRejectedExecutionHandler;
|
||||
import org.elasticsearch.common.xcontent.ToXContentFragment;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.core.internal.io.IOUtils;
|
||||
import org.elasticsearch.node.Node;
|
||||
|
||||
import java.io.Closeable;
|
||||
|
@ -197,7 +197,7 @@ public class ThreadPool extends AbstractComponent implements Scheduler, Closeabl
|
|||
threadContext = new ThreadContext(settings);
|
||||
|
||||
final Map<String, ExecutorHolder> executors = new HashMap<>();
|
||||
for (@SuppressWarnings("unchecked") final Map.Entry<String, ExecutorBuilder> entry : builders.entrySet()) {
|
||||
for (final Map.Entry<String, ExecutorBuilder> entry : builders.entrySet()) {
|
||||
final ExecutorBuilder.ExecutorSettings executorSettings = entry.getValue().getSettings(settings);
|
||||
final ExecutorHolder executorHolder = entry.getValue().build(executorSettings, threadContext);
|
||||
if (executors.containsKey(executorHolder.info.getName())) {
|
||||
|
@ -338,6 +338,7 @@ public class ThreadPool extends AbstractComponent implements Scheduler, Closeabl
|
|||
* the ScheduledFuture will cannot interact with it.
|
||||
* @throws org.elasticsearch.common.util.concurrent.EsRejectedExecutionException if the task cannot be scheduled for execution
|
||||
*/
|
||||
@Override
|
||||
public ScheduledFuture<?> schedule(TimeValue delay, String executor, Runnable command) {
|
||||
if (!Names.SAME.equals(executor)) {
|
||||
command = new ThreadedRunnable(command, executor(executor));
|
||||
|
@ -358,6 +359,7 @@ public class ThreadPool extends AbstractComponent implements Scheduler, Closeabl
|
|||
command, executor), e));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Runnable preserveContext(Runnable command) {
|
||||
return getThreadContext().preserveContext(command);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ public interface TransportResponseHandler<T extends TransportResponse> extends W
|
|||
*
|
||||
* @return the deserialized response.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
default T read(StreamInput in) throws IOException {
|
||||
T instance = newInstance();
|
||||
|
|
|
@ -153,7 +153,6 @@ public class IndicesStatsTests extends ESSingleNodeTestCase {
|
|||
assertEquals(0, common.refresh.getListeners());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testUuidOnRootStatsIndices() {
|
||||
String uuid = createIndex("test").indexUUID();
|
||||
IndicesStatsResponse rsp = client().admin().indices().prepareStats().get();
|
||||
|
|
|
@ -672,7 +672,6 @@ public class MetaDataTests extends ESTestCase {
|
|||
public static void assertLeafs(Map<String, Object> properties, String... fields) {
|
||||
for (String field : fields) {
|
||||
assertTrue(properties.containsKey(field));
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> fieldProp = (Map<String, Object>)properties.get(field);
|
||||
assertNotNull(fieldProp);
|
||||
assertFalse(fieldProp.containsKey("properties"));
|
||||
|
|
|
@ -123,7 +123,7 @@ public class BlobStoreRepositoryTests extends ESSingleNodeTestCase {
|
|||
|
||||
logger.info("--> make sure the node's repository can resolve the snapshots");
|
||||
final RepositoriesService repositoriesService = getInstanceFromNode(RepositoriesService.class);
|
||||
@SuppressWarnings("unchecked") final BlobStoreRepository repository =
|
||||
final BlobStoreRepository repository =
|
||||
(BlobStoreRepository) repositoriesService.repository(repositoryName);
|
||||
final List<SnapshotId> originalSnapshots = Arrays.asList(snapshotId1, snapshotId2);
|
||||
|
||||
|
@ -245,7 +245,7 @@ public class BlobStoreRepositoryTests extends ESSingleNodeTestCase {
|
|||
assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));
|
||||
|
||||
final RepositoriesService repositoriesService = getInstanceFromNode(RepositoriesService.class);
|
||||
@SuppressWarnings("unchecked") final BlobStoreRepository repository =
|
||||
final BlobStoreRepository repository =
|
||||
(BlobStoreRepository) repositoriesService.repository(repositoryName);
|
||||
assertThat("getBlobContainer has to be lazy initialized", repository.getBlobContainer(), nullValue());
|
||||
return repository;
|
||||
|
|
|
@ -32,9 +32,9 @@ import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
|||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude;
|
||||
import org.elasticsearch.search.aggregations.metrics.avg.Avg;
|
||||
import org.elasticsearch.search.aggregations.metrics.max.Max;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.Stats;
|
||||
|
@ -84,7 +84,6 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
|||
public static class CustomScriptPlugin extends AggregationTestScriptsPlugin {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Map<String, Function<Map<String, Object>, Object>> pluginScripts() {
|
||||
Map<String, Function<Map<String, Object>, Object>> scripts = super.pluginScripts();
|
||||
|
||||
|
|
|
@ -81,7 +81,6 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
|||
public static class CustomScriptPlugin extends AggregationTestScriptsPlugin {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Map<String, Function<Map<String, Object>, Object>> pluginScripts() {
|
||||
Map<String, Function<Map<String, Object>, Object>> scripts = super.pluginScripts();
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.elasticsearch.search.aggregations.bucket;
|
|||
import com.carrotsearch.hppc.LongHashSet;
|
||||
import com.carrotsearch.hppc.LongSet;
|
||||
import com.carrotsearch.randomizedtesting.generators.RandomStrings;
|
||||
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
|
@ -77,7 +78,6 @@ public class MinDocCountIT extends AbstractTermsTestCase {
|
|||
public static class CustomScriptPlugin extends AggregationTestScriptsPlugin {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Map<String, Function<Map<String, Object>, Object>> pluginScripts() {
|
||||
Map<String, Function<Map<String, Object>, Object>> scripts = new HashMap<>();
|
||||
|
||||
|
|
|
@ -75,7 +75,6 @@ public class RangeIT extends ESIntegTestCase {
|
|||
public static class CustomScriptPlugin extends AggregationTestScriptsPlugin {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Map<String, Function<Map<String, Object>, Object>> pluginScripts() {
|
||||
Map<String, Function<Map<String, Object>, Object>> scripts = super.pluginScripts();
|
||||
|
||||
|
|
|
@ -1746,7 +1746,6 @@ public class CompositeAggregatorTests extends AggregatorTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static Map<String, Object> createAfterKey(Object... fields) {
|
||||
assert fields.length % 2 == 0;
|
||||
final Map<String, Object> map = new HashMap<>();
|
||||
|
|
|
@ -36,9 +36,6 @@ import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
|||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
import org.elasticsearch.search.aggregations.bucket.AbstractTermsTestCase;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket;
|
||||
import org.elasticsearch.search.aggregations.metrics.avg.Avg;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.Stats;
|
||||
|
@ -103,7 +100,6 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
|||
public static class CustomScriptPlugin extends AggregationTestScriptsPlugin {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Map<String, Function<Map<String, Object>, Object>> pluginScripts() {
|
||||
Map<String, Function<Map<String, Object>, Object>> scripts = super.pluginScripts();
|
||||
|
||||
|
|
|
@ -262,7 +262,6 @@ public class CumulativeSumAggregatorTests extends AggregatorTestCase {
|
|||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void executeTestCase(Query query, AggregationBuilder aggBuilder, Consumer<InternalAggregation> verify) throws IOException {
|
||||
executeTestCase(query, aggBuilder, verify, indexWriter -> {
|
||||
Document document = new Document();
|
||||
|
@ -282,7 +281,6 @@ public class CumulativeSumAggregatorTests extends AggregatorTestCase {
|
|||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void executeTestCase(Query query, AggregationBuilder aggBuilder, Consumer<InternalAggregation> verify,
|
||||
CheckedConsumer<RandomIndexWriter, IOException> setup) throws IOException {
|
||||
|
||||
|
|
|
@ -98,7 +98,6 @@ public class MovFnUnitTests extends AggregatorTestCase {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void executeTestCase(Query query,
|
||||
DateHistogramAggregationBuilder aggBuilder,
|
||||
Consumer<Histogram> verify,
|
||||
|
|
|
@ -96,7 +96,6 @@ public class SearchFieldsIT extends ESIntegTestCase {
|
|||
public static class CustomScriptPlugin extends MockScriptPlugin {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Map<String, Function<Map<String, Object>, Object>> pluginScripts() {
|
||||
Map<String, Function<Map<String, Object>, Object>> scripts = new HashMap<>();
|
||||
|
||||
|
@ -143,7 +142,6 @@ public class SearchFieldsIT extends ESIntegTestCase {
|
|||
return scripts;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static Object fieldsScript(Map<String, Object> vars, String fieldName) {
|
||||
Map<?, ?> fields = (Map) vars.get("_fields");
|
||||
FieldLookup fieldLookup = (FieldLookup) fields.get(fieldName);
|
||||
|
@ -156,7 +154,6 @@ public class SearchFieldsIT extends ESIntegTestCase {
|
|||
return XContentMapValues.extractValue(path, source);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static Object docScript(Map<String, Object> vars, String fieldName) {
|
||||
Map<?, ?> doc = (Map) vars.get("doc");
|
||||
ScriptDocValues<?> values = (ScriptDocValues<?>) doc.get(fieldName);
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.elasticsearch.plugins.Plugin;
|
|||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.ScoreAccessor;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
||||
|
@ -48,8 +49,6 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
|||
import static org.elasticsearch.index.query.QueryBuilders.functionScoreQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||
import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.scriptFunction;
|
||||
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||
import static org.elasticsearch.search.builder.SearchSourceBuilder.searchSource;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
|
@ -70,7 +69,6 @@ public class FunctionScoreIT extends ESIntegTestCase {
|
|||
public static class CustomScriptPlugin extends MockScriptPlugin {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Map<String, Function<Map<String, Object>, Object>> pluginScripts() {
|
||||
Map<String, Function<Map<String, Object>, Object>> scripts = new HashMap<>();
|
||||
scripts.put("1", vars -> 1.0d);
|
||||
|
|
|
@ -67,7 +67,6 @@ public class RandomScoreFunctionIT extends ESIntegTestCase {
|
|||
public static class CustomScriptPlugin extends MockScriptPlugin {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Map<String, Function<Map<String, Object>, Object>> pluginScripts() {
|
||||
Map<String, Function<Map<String, Object>, Object>> scripts = new HashMap<>();
|
||||
|
||||
|
@ -84,7 +83,6 @@ public class RandomScoreFunctionIT extends ESIntegTestCase {
|
|||
return scripts;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static Double scoringScript(Map<String, Object> vars, Function<ScoreAccessor, Number> scoring) {
|
||||
Map<?, ?> doc = (Map) vars.get("doc");
|
||||
Double index = ((Number) ((ScriptDocValues<?>) doc.get("index")).getValues().get(0)).doubleValue();
|
||||
|
|
|
@ -86,7 +86,6 @@ import static org.hamcrest.Matchers.nullValue;
|
|||
public class FieldSortIT extends ESIntegTestCase {
|
||||
public static class CustomScriptPlugin extends MockScriptPlugin {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Map<String, Function<Map<String, Object>, Object>> pluginScripts() {
|
||||
Map<String, Function<Map<String, Object>, Object>> scripts = new HashMap<>();
|
||||
scripts.put("doc['number'].value", vars -> sortDoubleScript(vars));
|
||||
|
@ -94,14 +93,12 @@ public class FieldSortIT extends ESIntegTestCase {
|
|||
return scripts;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static Double sortDoubleScript(Map<String, Object> vars) {
|
||||
Map<?, ?> doc = (Map) vars.get("doc");
|
||||
Double index = ((Number) ((ScriptDocValues<?>) doc.get("number")).getValues().get(0)).doubleValue();
|
||||
return index;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static String sortStringScript(Map<String, Object> vars) {
|
||||
Map<?, ?> doc = (Map) vars.get("doc");
|
||||
String value = ((String) ((ScriptDocValues<?>) doc.get("keyword")).getValues().get(0));
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.elasticsearch.index.fielddata.ScriptDocValues;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.MockScriptPlugin;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.sort.ScriptSortBuilder.ScriptSortType;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
@ -50,8 +51,6 @@ import java.util.function.Function;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import static org.elasticsearch.search.sort.SortBuilders.scriptSort;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
|
@ -104,7 +103,6 @@ public class SimpleSortIT extends ESIntegTestCase {
|
|||
/**
|
||||
* Return the minimal value from a set of values.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
static <T extends Comparable<T>> T getMinValueScript(Map<String, Object> vars, T initialValue, String fieldName,
|
||||
Function<Object, T> converter) {
|
||||
T retval = initialValue;
|
||||
|
|
|
@ -248,7 +248,7 @@ public abstract class ESBlobStoreRepositoryIntegTestCase extends ESIntegTestCase
|
|||
logger.info("--> verify index folder deleted from blob container");
|
||||
RepositoriesService repositoriesSvc = internalCluster().getInstance(RepositoriesService.class, internalCluster().getMasterName());
|
||||
ThreadPool threadPool = internalCluster().getInstance(ThreadPool.class, internalCluster().getMasterName());
|
||||
@SuppressWarnings("unchecked") BlobStoreRepository repository = (BlobStoreRepository) repositoriesSvc.repository(repoName);
|
||||
BlobStoreRepository repository = (BlobStoreRepository) repositoriesSvc.repository(repoName);
|
||||
|
||||
final SetOnce<BlobContainer> indicesBlobContainer = new SetOnce<>();
|
||||
final SetOnce<RepositoryData> repositoryData = new SetOnce<>();
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.carrotsearch.randomizedtesting.generators.RandomNumbers;
|
|||
import com.carrotsearch.randomizedtesting.generators.RandomPicks;
|
||||
import com.carrotsearch.randomizedtesting.generators.RandomStrings;
|
||||
import com.carrotsearch.randomizedtesting.rules.TestRuleAdapter;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
@ -1070,7 +1071,6 @@ public abstract class ESTestCase extends LuceneTestCase {
|
|||
List<Object> targetList = new ArrayList<>();
|
||||
for(Object value : list) {
|
||||
if (value instanceof Map) {
|
||||
@SuppressWarnings("unchecked")
|
||||
LinkedHashMap<String, Object> valueMap = (LinkedHashMap<String, Object>) value;
|
||||
targetList.add(shuffleMap(valueMap, exceptFields));
|
||||
} else if(value instanceof List) {
|
||||
|
@ -1090,7 +1090,6 @@ public abstract class ESTestCase extends LuceneTestCase {
|
|||
for (String key : keys) {
|
||||
Object value = map.get(key);
|
||||
if (value instanceof Map && exceptFields.contains(key) == false) {
|
||||
@SuppressWarnings("unchecked")
|
||||
LinkedHashMap<String, Object> valueMap = (LinkedHashMap<String, Object>) value;
|
||||
targetMap.put(key, shuffleMap(valueMap, exceptFields));
|
||||
} else if(value instanceof List && exceptFields.contains(key) == false) {
|
||||
|
|
|
@ -49,6 +49,8 @@ import org.elasticsearch.common.Nullable;
|
|||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.xcontent.DeprecationHandler;
|
||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
|
@ -685,7 +687,6 @@ public class ElasticsearchAssertions {
|
|||
/**
|
||||
* Compares two lists recursively, but using arrays comparisons for byte[] through Arrays.equals(byte[], byte[])
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void assertListEquals(List<Object> expected, List<Object> actual) {
|
||||
assertEquals(expected.size(), actual.size());
|
||||
Iterator<Object> actualIterator = actual.iterator();
|
||||
|
|
|
@ -54,7 +54,6 @@ public class GreaterThanAssertion extends Assertion {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void doAssert(Object actualValue, Object expectedValue) {
|
||||
logger.trace("assert that [{}] is greater than [{}] (field: [{}])", actualValue, expectedValue, getField());
|
||||
assertThat("value of [" + getField() + "] is not comparable (got [" + safeClass(actualValue) + "])",
|
||||
|
|
|
@ -64,7 +64,7 @@ public class MockTcpTransportTests extends AbstractSimpleTransportTestCase {
|
|||
@Override
|
||||
protected void closeConnectionChannel(Transport transport, Transport.Connection connection) throws IOException {
|
||||
final MockTcpTransport t = (MockTcpTransport) transport;
|
||||
@SuppressWarnings("unchecked") final TcpTransport.NodeChannels channels =
|
||||
final TcpTransport.NodeChannels channels =
|
||||
(TcpTransport.NodeChannels) connection;
|
||||
CloseableChannel.closeChannels(channels.getChannels().subList(0, randomIntBetween(1, channels.getChannels().size())), true);
|
||||
}
|
||||
|
|
|
@ -96,7 +96,6 @@ public class SimpleMockNioTransportTests extends AbstractSimpleTransportTestCase
|
|||
|
||||
@Override
|
||||
protected void closeConnectionChannel(Transport transport, Transport.Connection connection) throws IOException {
|
||||
@SuppressWarnings("unchecked")
|
||||
TcpTransport.NodeChannels channels = (TcpTransport.NodeChannels) connection;
|
||||
CloseableChannel.closeChannels(channels.getChannels().subList(0, randomIntBetween(1, channels.getChannels().size())), true);
|
||||
}
|
||||
|
|
|
@ -100,7 +100,6 @@ public class SecurityClient {
|
|||
* Clears the realm caches. It's possible to clear all user entries from all realms in the cluster or alternatively
|
||||
* select the realms (by their unique names) and/or users (by their usernames) that should be evicted.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public ClearRealmCacheRequestBuilder prepareClearRealmCache() {
|
||||
return new ClearRealmCacheRequestBuilder(client);
|
||||
}
|
||||
|
@ -109,7 +108,6 @@ public class SecurityClient {
|
|||
* Clears the realm caches. It's possible to clear all user entries from all realms in the cluster or alternatively
|
||||
* select the realms (by their unique names) and/or users (by their usernames) that should be evicted.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void clearRealmCache(ClearRealmCacheRequest request, ActionListener<ClearRealmCacheResponse> listener) {
|
||||
client.execute(ClearRealmCacheAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
@ -118,7 +116,6 @@ public class SecurityClient {
|
|||
* Clears the realm caches. It's possible to clear all user entries from all realms in the cluster or alternatively
|
||||
* select the realms (by their unique names) and/or users (by their usernames) that should be evicted.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public ActionFuture<ClearRealmCacheResponse> clearRealmCache(ClearRealmCacheRequest request) {
|
||||
return client.execute(ClearRealmCacheAction.INSTANCE, request);
|
||||
}
|
||||
|
|
|
@ -76,7 +76,6 @@ public class IndexUpgradeAction extends Action<BulkByScrollResponse> {
|
|||
/**
|
||||
* Sets the index.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Request index(String index) {
|
||||
this.index = index;
|
||||
return this;
|
||||
|
|
|
@ -37,7 +37,6 @@ public class MlRestTestStateCleaner {
|
|||
final Request datafeedsRequest = new Request("GET", "/_xpack/ml/datafeeds");
|
||||
datafeedsRequest.addParameter("filter_path", "datafeeds");
|
||||
final Response datafeedsResponse = adminClient.performRequest(datafeedsRequest);
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<Map<String, Object>> datafeeds =
|
||||
(List<Map<String, Object>>) XContentMapValues.extractValue("datafeeds", ESRestTestCase.entityAsMap(datafeedsResponse));
|
||||
if (datafeeds == null) {
|
||||
|
|
|
@ -147,7 +147,6 @@ public class AnomalyRecordTests extends AbstractSerializingTestCase<AnomalyRecor
|
|||
assertEquals(Arrays.asList("yes", "no"), serialisedSpoilerFieldValues);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testToXContentDoesNotIncludesReservedWordInputFields() throws IOException {
|
||||
AnomalyRecord record = createTestInstance();
|
||||
record.setByFieldName(AnomalyRecord.BUCKET_SPAN.getPreferredName());
|
||||
|
@ -157,7 +156,7 @@ public class AnomalyRecordTests extends AbstractSerializingTestCase<AnomalyRecor
|
|||
XContentParser parser = createParser(XContentType.JSON.xContent(), bytes);
|
||||
Object value = parser.map().get(AnomalyRecord.BUCKET_SPAN.getPreferredName());
|
||||
assertNotEquals("bar", value);
|
||||
assertEquals((Long)record.getBucketSpan(), (Long)value);
|
||||
assertEquals(record.getBucketSpan(), value);
|
||||
}
|
||||
|
||||
public void testId() {
|
||||
|
|
|
@ -65,7 +65,6 @@ public class RollupRestTestStateCleaner {
|
|||
private static void deleteAllJobs(RestClient adminClient) throws Exception {
|
||||
Response response = adminClient.performRequest("GET", "/_xpack/rollup/job/_all");
|
||||
Map<String, Object> jobs = ESRestTestCase.entityAsMap(response);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Map<String, Object>> jobConfigs =
|
||||
(List<Map<String, Object>>) XContentMapValues.extractValue("jobs", jobs);
|
||||
|
||||
|
|
|
@ -43,13 +43,13 @@ import org.elasticsearch.xpack.core.ml.action.util.QueryPage;
|
|||
import org.elasticsearch.xpack.core.ml.job.config.Job;
|
||||
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex;
|
||||
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndexFields;
|
||||
import org.elasticsearch.xpack.ml.job.persistence.InfluencersQueryBuilder.InfluencersQuery;
|
||||
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.ModelSnapshot;
|
||||
import org.elasticsearch.xpack.core.ml.job.results.AnomalyRecord;
|
||||
import org.elasticsearch.xpack.core.ml.job.results.Bucket;
|
||||
import org.elasticsearch.xpack.core.ml.job.results.CategoryDefinition;
|
||||
import org.elasticsearch.xpack.core.ml.job.results.Influencer;
|
||||
import org.elasticsearch.xpack.core.ml.job.results.Result;
|
||||
import org.elasticsearch.xpack.ml.job.persistence.InfluencersQueryBuilder.InfluencersQuery;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -252,7 +252,7 @@ public class JobProviderTests extends ESTestCase {
|
|||
|
||||
BucketsQueryBuilder bq = new BucketsQueryBuilder().from(from).size(size).anomalyScoreThreshold(1.0);
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
QueryPage<Bucket>[] holder = new QueryPage[1];
|
||||
provider.buckets(jobId, bq, r -> holder[0] = r, e -> {throw new RuntimeException(e);}, client);
|
||||
QueryPage<Bucket> buckets = holder[0];
|
||||
|
@ -286,7 +286,7 @@ public class JobProviderTests extends ESTestCase {
|
|||
BucketsQueryBuilder bq = new BucketsQueryBuilder().from(from).size(size).anomalyScoreThreshold(5.1)
|
||||
.includeInterim(true);
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
QueryPage<Bucket>[] holder = new QueryPage[1];
|
||||
provider.buckets(jobId, bq, r -> holder[0] = r, e -> {throw new RuntimeException(e);}, client);
|
||||
QueryPage<Bucket> buckets = holder[0];
|
||||
|
@ -322,7 +322,7 @@ public class JobProviderTests extends ESTestCase {
|
|||
bq.anomalyScoreThreshold(5.1);
|
||||
bq.includeInterim(true);
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
QueryPage<Bucket>[] holder = new QueryPage[1];
|
||||
provider.buckets(jobId, bq, r -> holder[0] = r, e -> {throw new RuntimeException(e);}, client);
|
||||
QueryPage<Bucket> buckets = holder[0];
|
||||
|
@ -368,7 +368,7 @@ public class JobProviderTests extends ESTestCase {
|
|||
BucketsQueryBuilder bq = new BucketsQueryBuilder();
|
||||
bq.timestamp(Long.toString(now.getTime()));
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
QueryPage<Bucket>[] bucketHolder = new QueryPage[1];
|
||||
provider.buckets(jobId, bq, q -> bucketHolder[0] = q, e -> {}, client);
|
||||
assertThat(bucketHolder[0].count(), equalTo(1L));
|
||||
|
@ -409,7 +409,7 @@ public class JobProviderTests extends ESTestCase {
|
|||
.epochEnd(String.valueOf(now.getTime())).includeInterim(true).sortField(sortfield)
|
||||
.recordScore(2.2);
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
QueryPage<AnomalyRecord>[] holder = new QueryPage[1];
|
||||
provider.records(jobId, rqb, page -> holder[0] = page, RuntimeException::new, client);
|
||||
QueryPage<AnomalyRecord> recordPage = holder[0];
|
||||
|
@ -462,7 +462,7 @@ public class JobProviderTests extends ESTestCase {
|
|||
rqb.sortField(sortfield);
|
||||
rqb.recordScore(2.2);
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
QueryPage<AnomalyRecord>[] holder = new QueryPage[1];
|
||||
provider.records(jobId, rqb, page -> holder[0] = page, RuntimeException::new, client);
|
||||
QueryPage<AnomalyRecord> recordPage = holder[0];
|
||||
|
@ -507,7 +507,7 @@ public class JobProviderTests extends ESTestCase {
|
|||
Client client = getMockedClient(qb -> {}, response);
|
||||
JobProvider provider = createProvider(client);
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
QueryPage<AnomalyRecord>[] holder = new QueryPage[1];
|
||||
provider.bucketRecords(jobId, bucket, from, size, true, sortfield, true, page -> holder[0] = page, RuntimeException::new,
|
||||
client);
|
||||
|
@ -568,7 +568,7 @@ public class JobProviderTests extends ESTestCase {
|
|||
Client client = getMockedClient(q -> {}, response);
|
||||
|
||||
JobProvider provider = createProvider(client);
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
QueryPage<CategoryDefinition>[] holder = new QueryPage[1];
|
||||
provider.categoryDefinitions(jobId, null, false, from, size, r -> holder[0] = r,
|
||||
e -> {throw new RuntimeException(e);}, client);
|
||||
|
@ -590,7 +590,7 @@ public class JobProviderTests extends ESTestCase {
|
|||
SearchResponse response = createSearchResponse(Collections.singletonList(source));
|
||||
Client client = getMockedClient(q -> {}, response);
|
||||
JobProvider provider = createProvider(client);
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
QueryPage<CategoryDefinition>[] holder = new QueryPage[1];
|
||||
provider.categoryDefinitions(jobId, categoryId, false, null, null,
|
||||
r -> holder[0] = r, e -> {throw new RuntimeException(e);}, client);
|
||||
|
@ -632,7 +632,7 @@ public class JobProviderTests extends ESTestCase {
|
|||
Client client = getMockedClient(q -> qbHolder[0] = q, response);
|
||||
JobProvider provider = createProvider(client);
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
QueryPage<Influencer>[] holder = new QueryPage[1];
|
||||
InfluencersQuery query = new InfluencersQueryBuilder().from(from).size(size).includeInterim(false).build();
|
||||
provider.influencers(jobId, query, page -> holder[0] = page, RuntimeException::new, client);
|
||||
|
@ -692,7 +692,7 @@ public class JobProviderTests extends ESTestCase {
|
|||
Client client = getMockedClient(q -> qbHolder[0] = q, response);
|
||||
JobProvider provider = createProvider(client);
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
QueryPage<Influencer>[] holder = new QueryPage[1];
|
||||
InfluencersQuery query = new InfluencersQueryBuilder().from(from).size(size).start("0").end("0").sortField("sort")
|
||||
.sortDescending(true).influencerScoreThreshold(0.0).includeInterim(true).build();
|
||||
|
@ -747,7 +747,7 @@ public class JobProviderTests extends ESTestCase {
|
|||
Client client = getMockedClient(qb -> {}, response);
|
||||
JobProvider provider = createProvider(client);
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
QueryPage<ModelSnapshot>[] holder = new QueryPage[1];
|
||||
provider.modelSnapshots(jobId, from, size, r -> holder[0] = r, RuntimeException::new);
|
||||
QueryPage<ModelSnapshot> page = holder[0];
|
||||
|
|
|
@ -195,7 +195,7 @@ public class JobResultsPersisterTests extends ESTestCase {
|
|||
verifyNoMoreInteractions(client);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
private Client mockClient(ArgumentCaptor<BulkRequest> captor) {
|
||||
Client client = mock(Client.class);
|
||||
ThreadPool threadPool = mock(ThreadPool.class);
|
||||
|
|
|
@ -65,7 +65,6 @@ public class ScoresUpdaterTests extends ESTestCase {
|
|||
}
|
||||
|
||||
@Before
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setUpMocks() throws IOException {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
|
|
|
@ -35,11 +35,11 @@ import org.elasticsearch.threadpool.ThreadPoolStats;
|
|||
import org.elasticsearch.xpack.core.XPackSettings;
|
||||
import org.elasticsearch.xpack.core.action.XPackUsageRequestBuilder;
|
||||
import org.elasticsearch.xpack.core.action.XPackUsageResponse;
|
||||
import org.elasticsearch.xpack.core.monitoring.MonitoredSystem;
|
||||
import org.elasticsearch.xpack.core.monitoring.MonitoringFeatureSetUsage;
|
||||
import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkRequestBuilder;
|
||||
import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkResponse;
|
||||
import org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils;
|
||||
import org.elasticsearch.xpack.core.monitoring.MonitoredSystem;
|
||||
import org.elasticsearch.xpack.core.monitoring.MonitoringFeatureSetUsage;
|
||||
import org.elasticsearch.xpack.monitoring.LocalStateMonitoring;
|
||||
import org.elasticsearch.xpack.monitoring.MonitoringService;
|
||||
import org.elasticsearch.xpack.monitoring.collector.cluster.ClusterStatsMonitoringDoc;
|
||||
|
@ -112,7 +112,6 @@ public class MonitoringIT extends ESSingleNodeTestCase {
|
|||
* This test uses the Monitoring Bulk API to index document as an external application like Kibana would do. It
|
||||
* then ensure that the documents were correctly indexed and have the expected information.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testMonitoringBulk() throws Exception {
|
||||
whenExportersAreReady(() -> {
|
||||
final MonitoredSystem system = randomSystem();
|
||||
|
@ -188,7 +187,6 @@ public class MonitoringIT extends ESSingleNodeTestCase {
|
|||
* have been indexed with the expected information.
|
||||
*/
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/29880")
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testMonitoringService() throws Exception {
|
||||
final boolean createAPMIndex = randomBoolean();
|
||||
final String indexName = createAPMIndex ? "apm-2017.11.06" : "books";
|
||||
|
@ -284,7 +282,6 @@ public class MonitoringIT extends ESSingleNodeTestCase {
|
|||
* Asserts that the source_node information (provided as a Map) of a monitoring document correspond to
|
||||
* the current local node information
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void assertMonitoringDocSourceNode(final Map<String, Object> sourceNode) {
|
||||
assertEquals(6, sourceNode.size());
|
||||
|
||||
|
@ -541,7 +538,6 @@ public class MonitoringIT extends ESSingleNodeTestCase {
|
|||
/**
|
||||
* Disable the monitoring service and the Local exporter.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void disableMonitoring() throws Exception {
|
||||
final Settings settings = Settings.builder()
|
||||
.putNull("xpack.monitoring.collection.enabled")
|
||||
|
|
|
@ -541,7 +541,6 @@ public class AuthenticationService extends AbstractComponent {
|
|||
|
||||
private final RestRequest request;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
AuditableRestRequest(AuditTrail auditTrail, AuthenticationFailureHandler failureHandler, ThreadContext threadContext,
|
||||
RestRequest request) {
|
||||
super(auditTrail, failureHandler, threadContext);
|
||||
|
|
|
@ -58,7 +58,6 @@ public class RestAuthenticateActionTests extends SecurityIntegTestCase {
|
|||
assertThat(response.getStatusLine().getStatusCode(), is(200));
|
||||
ObjectPath objectPath = ObjectPath.createFromResponse(response);
|
||||
assertThat(objectPath.evaluate("username").toString(), equalTo(SecuritySettingsSource.TEST_USER_NAME));
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> roles = objectPath.evaluate("roles");
|
||||
assertThat(roles.size(), is(1));
|
||||
assertThat(roles, contains(SecuritySettingsSource.TEST_ROLE));
|
||||
|
|
|
@ -35,9 +35,6 @@ import org.elasticsearch.xpack.core.common.socket.SocketAccess;
|
|||
import org.elasticsearch.xpack.core.ssl.SSLConfiguration;
|
||||
import org.elasticsearch.xpack.core.ssl.SSLService;
|
||||
|
||||
import javax.net.SocketFactory;
|
||||
import javax.net.ssl.HandshakeCompletedListener;
|
||||
import javax.net.ssl.SSLSocket;
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.SocketTimeoutException;
|
||||
|
@ -47,6 +44,10 @@ import java.util.Collections;
|
|||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import javax.net.SocketFactory;
|
||||
import javax.net.ssl.HandshakeCompletedListener;
|
||||
import javax.net.ssl.SSLSocket;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Collections.emptySet;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
|
@ -119,7 +120,6 @@ public class SimpleSecurityNioTransportTests extends AbstractSimpleTransportTest
|
|||
|
||||
@Override
|
||||
protected void closeConnectionChannel(Transport transport, Transport.Connection connection) throws IOException {
|
||||
@SuppressWarnings("unchecked")
|
||||
TcpTransport.NodeChannels channels = (TcpTransport.NodeChannels) connection;
|
||||
CloseableChannel.closeChannels(channels.getChannels().subList(0, randomIntBetween(1, channels.getChannels().size())), true);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
package org.elasticsearch.xpack.test.rest;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.client.Response;
|
||||
|
@ -219,7 +220,6 @@ public class XPackRestIT extends ESClientYamlSuiteTestCase {
|
|||
@SuppressWarnings("unchecked")
|
||||
final Map<String, Object> node = (Map<String, Object>) nodes.values().iterator().next();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
final Number activeWrites = (Number) extractValue("thread_pool.write.active", node);
|
||||
return activeWrites != null && activeWrites.longValue() == 0L;
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -7,6 +7,7 @@ package org.elasticsearch.xpack.security.authc.ldap;
|
|||
|
||||
import com.unboundid.ldap.sdk.LDAPException;
|
||||
import com.unboundid.ldap.sdk.ResultCode;
|
||||
|
||||
import org.elasticsearch.action.support.PlainActionFuture;
|
||||
import org.elasticsearch.common.settings.SecureString;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -302,7 +303,6 @@ public class ActiveDirectorySessionFactoryTests extends AbstractActiveDirectoryT
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/29840")
|
||||
public void testHandlingLdapReferralErrors() throws Exception {
|
||||
String groupSearchBase = "DC=ad,DC=test,DC=elasticsearch,DC=com";
|
||||
|
|
Loading…
Reference in New Issue