Skip to content

Commit

Permalink
Remove unused / obsolete import and throws statements
Browse files Browse the repository at this point in the history
This commit removes unused thorws statements when RuntimeExceptions are
mentioned in the throws statement. It also removes obsolete import statements
for java.lang.IllegalArgumentException and java.lang.IllegalStateException
  • Loading branch information
s1monw committed Apr 29, 2015
1 parent 94cc785 commit e34db4d
Show file tree
Hide file tree
Showing 576 changed files with 483 additions and 930 deletions.
Expand Up @@ -21,7 +21,6 @@

import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import java.lang.IllegalArgumentException;

import java.io.IOException;
import java.util.Collections;
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/apache/lucene/store/StoreRateLimiting.java
Expand Up @@ -19,7 +19,6 @@
package org.apache.lucene.store;

import org.apache.lucene.store.RateLimiter.SimpleRateLimiter;
import java.lang.IllegalArgumentException;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.unit.ByteSizeValue;

Expand All @@ -42,7 +41,7 @@ public static enum Type {
MERGE,
ALL;

public static Type fromString(String type) throws IllegalArgumentException {
public static Type fromString(String type) {
if ("none".equalsIgnoreCase(type)) {
return NONE;
} else if ("merge".equalsIgnoreCase(type)) {
Expand Down Expand Up @@ -88,7 +87,7 @@ public void setType(Type type) {
this.type = type;
}

public void setType(String type) throws IllegalArgumentException {
public void setType(String type) {
this.type = Type.fromString(type);
}
}
10 changes: 5 additions & 5 deletions src/main/java/org/elasticsearch/action/ActionFuture.java
Expand Up @@ -42,7 +42,7 @@ public interface ActionFuture<T> extends Future<T> {
* from {@link org.elasticsearch.transport.RemoteTransportException}. The root failure is
* still accessible using {@link #getRootFailure()}.
*/
T actionGet() throws ElasticsearchException;
T actionGet();

/**
* Similar to {@link #get(long, java.util.concurrent.TimeUnit)}, just catching the {@link InterruptedException} and throwing
Expand All @@ -53,7 +53,7 @@ public interface ActionFuture<T> extends Future<T> {
* from {@link org.elasticsearch.transport.RemoteTransportException}. The root failure is
* still accessible using {@link #getRootFailure()}.
*/
T actionGet(String timeout) throws ElasticsearchException;
T actionGet(String timeout);

/**
* Similar to {@link #get(long, java.util.concurrent.TimeUnit)}, just catching the {@link InterruptedException} and throwing
Expand All @@ -66,7 +66,7 @@ public interface ActionFuture<T> extends Future<T> {
*
* @param timeoutMillis Timeout in millis
*/
T actionGet(long timeoutMillis) throws ElasticsearchException;
T actionGet(long timeoutMillis);

/**
* Similar to {@link #get(long, java.util.concurrent.TimeUnit)}, just catching the {@link InterruptedException} and throwing
Expand All @@ -77,7 +77,7 @@ public interface ActionFuture<T> extends Future<T> {
* from {@link org.elasticsearch.transport.RemoteTransportException}. The root failure is
* still accessible using {@link #getRootFailure()}.
*/
T actionGet(long timeout, TimeUnit unit) throws ElasticsearchException;
T actionGet(long timeout, TimeUnit unit);

/**
* Similar to {@link #get(long, java.util.concurrent.TimeUnit)}, just catching the {@link InterruptedException} and throwing
Expand All @@ -88,7 +88,7 @@ public interface ActionFuture<T> extends Future<T> {
* from {@link org.elasticsearch.transport.RemoteTransportException}. The root failure is
* still accessible using {@link #getRootFailure()}.
*/
T actionGet(TimeValue timeout) throws ElasticsearchException;
T actionGet(TimeValue timeout);

/**
* The root (possibly) wrapped failure.
Expand Down
Expand Up @@ -69,21 +69,21 @@ public ListenableActionFuture<Response> execute() {
/**
* Short version of execute().actionGet().
*/
public Response get() throws ElasticsearchException {
public Response get() {
return execute().actionGet();
}

/**
* Short version of execute().actionGet().
*/
public Response get(TimeValue timeout) throws ElasticsearchException {
public Response get(TimeValue timeout) {
return execute().actionGet(timeout);
}

/**
* Short version of execute().actionGet().
*/
public Response get(String timeout) throws ElasticsearchException {
public Response get(String timeout) {
return execute().actionGet(timeout);
}

Expand Down
Expand Up @@ -21,7 +21,6 @@

import org.elasticsearch.ElasticsearchException;

import java.lang.IllegalArgumentException;

import java.util.ArrayList;
import java.util.List;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/elasticsearch/action/ThreadingModel.java
Expand Up @@ -19,7 +19,6 @@

package org.elasticsearch.action;

import java.lang.IllegalArgumentException;

/**
*
Expand Down
Expand Up @@ -19,7 +19,6 @@

package org.elasticsearch.action;

import java.lang.IllegalArgumentException;

/**
* Write Consistency Level control how many replicas should be active for a write operation to occur (a write operation
Expand Down
Expand Up @@ -19,7 +19,6 @@

package org.elasticsearch.action.admin.cluster.health;

import java.lang.IllegalArgumentException;

/**
*
Expand Down
Expand Up @@ -20,7 +20,6 @@
package org.elasticsearch.action.admin.cluster.health;

import org.elasticsearch.ElasticsearchException;
import java.lang.IllegalStateException;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.IndicesOptions;
Expand Down Expand Up @@ -66,7 +65,7 @@ protected ClusterHealthResponse newResponse() {
}

@Override
protected void masterOperation(final ClusterHealthRequest request, final ClusterState unusedState, final ActionListener<ClusterHealthResponse> listener) throws ElasticsearchException {
protected void masterOperation(final ClusterHealthRequest request, final ClusterState unusedState, final ActionListener<ClusterHealthResponse> listener) {
if (request.waitForEvents() != null) {
final long endTime = System.currentTimeMillis() + request.timeout().millis();
clusterService.submitStateUpdateTask("cluster_health (wait_for_events [" + request.waitForEvents() + "])", request.waitForEvents(), new ProcessedClusterStateUpdateTask() {
Expand Down
Expand Up @@ -73,7 +73,7 @@ protected NodeHotThreads newNodeResponse() {
}

@Override
protected NodeHotThreads nodeOperation(NodeRequest request) throws ElasticsearchException {
protected NodeHotThreads nodeOperation(NodeRequest request) {
HotThreads hotThreads = new HotThreads()
.busiestThreads(request.request.threads)
.type(request.request.type)
Expand Down
Expand Up @@ -77,7 +77,7 @@ protected NodeInfo newNodeResponse() {
}

@Override
protected NodeInfo nodeOperation(NodeInfoRequest nodeRequest) throws ElasticsearchException {
protected NodeInfo nodeOperation(NodeInfoRequest nodeRequest) {
NodesInfoRequest request = nodeRequest.request;
return nodeService.info(request.settings(), request.os(), request.process(), request.jvm(), request.threadPool(),
request.network(), request.transport(), request.http(), request.plugins());
Expand Down
Expand Up @@ -77,7 +77,7 @@ protected NodeStats newNodeResponse() {
}

@Override
protected NodeStats nodeOperation(NodeStatsRequest nodeStatsRequest) throws ElasticsearchException {
protected NodeStats nodeOperation(NodeStatsRequest nodeStatsRequest) {
NodesStatsRequest request = nodeStatsRequest.request;
return nodeService.stats(request.indices(), request.os(), request.process(), request.jvm(), request.threadPool(), request.network(),
request.fs(), request.transport(), request.http(), request.breaker());
Expand Down
Expand Up @@ -64,7 +64,7 @@ protected ClusterBlockException checkBlock(DeleteRepositoryRequest request, Clus
}

@Override
protected void masterOperation(final DeleteRepositoryRequest request, ClusterState state, final ActionListener<DeleteRepositoryResponse> listener) throws ElasticsearchException {
protected void masterOperation(final DeleteRepositoryRequest request, ClusterState state, final ActionListener<DeleteRepositoryResponse> listener) {
repositoriesService.unregisterRepository(
new RepositoriesService.UnregisterRepositoryRequest("delete_repository [" + request.name() + "]", request.name())
.masterNodeTimeout(request.masterNodeTimeout()).ackTimeout(request.timeout()),
Expand Down
Expand Up @@ -64,7 +64,7 @@ protected ClusterBlockException checkBlock(GetRepositoriesRequest request, Clust
}

@Override
protected void masterOperation(final GetRepositoriesRequest request, ClusterState state, final ActionListener<GetRepositoriesResponse> listener) throws ElasticsearchException {
protected void masterOperation(final GetRepositoriesRequest request, ClusterState state, final ActionListener<GetRepositoriesResponse> listener) {
MetaData metaData = state.metaData();
RepositoriesMetaData repositories = metaData.custom(RepositoriesMetaData.TYPE);
if (request.repositories().length == 0 || (request.repositories().length == 1 && "_all".equals(request.repositories()[0]))) {
Expand Down
Expand Up @@ -20,7 +20,6 @@
package org.elasticsearch.action.admin.cluster.repositories.put;

import org.elasticsearch.ElasticsearchGenerationException;
import java.lang.IllegalArgumentException;

import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.master.AcknowledgedRequest;
Expand Down
Expand Up @@ -64,7 +64,7 @@ protected ClusterBlockException checkBlock(PutRepositoryRequest request, Cluster
}

@Override
protected void masterOperation(final PutRepositoryRequest request, ClusterState state, final ActionListener<PutRepositoryResponse> listener) throws ElasticsearchException {
protected void masterOperation(final PutRepositoryRequest request, ClusterState state, final ActionListener<PutRepositoryResponse> listener) {

repositoriesService.registerRepository(
new RepositoriesService.RegisterRepositoryRequest("put_repository [" + request.name() + "]",
Expand Down
Expand Up @@ -68,7 +68,7 @@ protected ClusterBlockException checkBlock(VerifyRepositoryRequest request, Clus
}

@Override
protected void masterOperation(final VerifyRepositoryRequest request, ClusterState state, final ActionListener<VerifyRepositoryResponse> listener) throws ElasticsearchException {
protected void masterOperation(final VerifyRepositoryRequest request, ClusterState state, final ActionListener<VerifyRepositoryResponse> listener) {
repositoriesService.verifyRepository(request.name(), new ActionListener<RepositoriesService.VerifyResponse>() {
@Override
public void onResponse(RepositoriesService.VerifyResponse verifyResponse) {
Expand Down
Expand Up @@ -67,7 +67,7 @@ protected ClusterRerouteResponse newResponse() {
}

@Override
protected void masterOperation(final ClusterRerouteRequest request, final ClusterState state, final ActionListener<ClusterRerouteResponse> listener) throws ElasticsearchException {
protected void masterOperation(final ClusterRerouteRequest request, final ClusterState state, final ActionListener<ClusterRerouteResponse> listener) {
clusterService.submitStateUpdateTask("cluster_reroute (api)", Priority.IMMEDIATE, new AckedClusterStateUpdateTask<ClusterRerouteResponse>(request, listener) {

private volatile ClusterState clusterStateToSend;
Expand Down
Expand Up @@ -86,7 +86,7 @@ protected ClusterUpdateSettingsResponse newResponse() {
}

@Override
protected void masterOperation(final ClusterUpdateSettingsRequest request, final ClusterState state, final ActionListener<ClusterUpdateSettingsResponse> listener) throws ElasticsearchException {
protected void masterOperation(final ClusterUpdateSettingsRequest request, final ClusterState state, final ActionListener<ClusterUpdateSettingsResponse> listener) {
final ImmutableSettings.Builder transientUpdates = ImmutableSettings.settingsBuilder();
final ImmutableSettings.Builder persistentUpdates = ImmutableSettings.settingsBuilder();

Expand Down
Expand Up @@ -19,7 +19,6 @@

package org.elasticsearch.action.admin.cluster.shards;

import java.lang.IllegalArgumentException;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.IndicesRequest;
import org.elasticsearch.action.support.IndicesOptions;
Expand Down
Expand Up @@ -67,7 +67,7 @@ protected ClusterSearchShardsResponse newResponse() {
}

@Override
protected void masterOperation(final ClusterSearchShardsRequest request, final ClusterState state, final ActionListener<ClusterSearchShardsResponse> listener) throws ElasticsearchException {
protected void masterOperation(final ClusterSearchShardsRequest request, final ClusterState state, final ActionListener<ClusterSearchShardsResponse> listener) {
ClusterState clusterState = clusterService.state();
String[] concreteIndices = clusterState.metaData().concreteIndices(request.indicesOptions(), request.indices());
Map<String, Set<String>> routingMap = clusterState.metaData().resolveSearchRouting(request.routing(), request.indices());
Expand Down
Expand Up @@ -20,7 +20,6 @@
package org.elasticsearch.action.admin.cluster.snapshots.create;

import org.elasticsearch.ElasticsearchGenerationException;
import java.lang.IllegalArgumentException;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.IndicesRequest;
import org.elasticsearch.action.support.IndicesOptions;
Expand Down
Expand Up @@ -64,7 +64,7 @@ protected ClusterBlockException checkBlock(CreateSnapshotRequest request, Cluste
}

@Override
protected void masterOperation(final CreateSnapshotRequest request, ClusterState state, final ActionListener<CreateSnapshotResponse> listener) throws ElasticsearchException {
protected void masterOperation(final CreateSnapshotRequest request, ClusterState state, final ActionListener<CreateSnapshotResponse> listener) {
SnapshotsService.SnapshotRequest snapshotRequest =
new SnapshotsService.SnapshotRequest("create_snapshot[" + request.snapshot() + "]", request.snapshot(), request.repository())
.indices(request.indices())
Expand Down
Expand Up @@ -63,7 +63,7 @@ protected ClusterBlockException checkBlock(DeleteSnapshotRequest request, Cluste
}

@Override
protected void masterOperation(final DeleteSnapshotRequest request, ClusterState state, final ActionListener<DeleteSnapshotResponse> listener) throws ElasticsearchException {
protected void masterOperation(final DeleteSnapshotRequest request, ClusterState state, final ActionListener<DeleteSnapshotResponse> listener) {
SnapshotId snapshotIds = new SnapshotId(request.repository(), request.snapshot());
snapshotsService.deleteSnapshot(snapshotIds, new SnapshotsService.DeleteSnapshotListener() {
@Override
Expand Down
Expand Up @@ -66,7 +66,7 @@ protected ClusterBlockException checkBlock(GetSnapshotsRequest request, ClusterS
}

@Override
protected void masterOperation(final GetSnapshotsRequest request, ClusterState state, final ActionListener<GetSnapshotsResponse> listener) throws ElasticsearchException {
protected void masterOperation(final GetSnapshotsRequest request, ClusterState state, final ActionListener<GetSnapshotsResponse> listener) {
try {
ImmutableList.Builder<SnapshotInfo> snapshotInfoBuilder = ImmutableList.builder();
if (isAllSnapshots(request.snapshots())) {
Expand Down
Expand Up @@ -20,7 +20,6 @@
package org.elasticsearch.action.admin.cluster.snapshots.restore;

import org.elasticsearch.ElasticsearchGenerationException;
import java.lang.IllegalArgumentException;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.IndicesOptions;
Expand Down
Expand Up @@ -70,7 +70,7 @@ protected ClusterBlockException checkBlock(RestoreSnapshotRequest request, Clust
}

@Override
protected void masterOperation(final RestoreSnapshotRequest request, ClusterState state, final ActionListener<RestoreSnapshotResponse> listener) throws ElasticsearchException {
protected void masterOperation(final RestoreSnapshotRequest request, ClusterState state, final ActionListener<RestoreSnapshotResponse> listener) {
RestoreService.RestoreRequest restoreRequest = new RestoreService.RestoreRequest(
"restore_snapshot[" + request.snapshot() + "]", request.repository(), request.snapshot(),
request.indices(), request.indicesOptions(), request.renamePattern(), request.renameReplacement(),
Expand Down
Expand Up @@ -19,7 +19,6 @@

package org.elasticsearch.action.admin.cluster.snapshots.status;

import java.lang.IllegalArgumentException;

/**
*/
Expand Down
Expand Up @@ -19,7 +19,6 @@

package org.elasticsearch.action.admin.cluster.snapshots.status;

import java.lang.IllegalArgumentException;
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
Expand Down
Expand Up @@ -19,7 +19,6 @@

package org.elasticsearch.action.admin.cluster.snapshots.status;

import java.lang.IllegalArgumentException;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
Expand Down
Expand Up @@ -94,7 +94,7 @@ protected NodesSnapshotStatus newResponse(Request request, AtomicReferenceArray
}

@Override
protected NodeSnapshotStatus nodeOperation(NodeRequest request) throws ElasticsearchException {
protected NodeSnapshotStatus nodeOperation(NodeRequest request) {
ImmutableMap.Builder<SnapshotId, ImmutableMap<ShardId, SnapshotIndexShardStatus>> snapshotMapBuilder = ImmutableMap.builder();
try {
String nodeId = clusterService.localNode().id();
Expand Down
Expand Up @@ -21,7 +21,6 @@

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import java.lang.IllegalArgumentException;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.master.TransportMasterNodeOperationAction;
Expand Down
Expand Up @@ -79,7 +79,7 @@ protected ClusterStateResponse newResponse() {
}

@Override
protected void masterOperation(final ClusterStateRequest request, final ClusterState state, ActionListener<ClusterStateResponse> listener) throws ElasticsearchException {
protected void masterOperation(final ClusterStateRequest request, final ClusterState state, ActionListener<ClusterStateResponse> listener) {
ClusterState currentState = clusterService.state();
logger.trace("Serving cluster state request using version {}", currentState.version());
ClusterState.Builder builder = ClusterState.builder(currentState.getClusterName());
Expand Down
Expand Up @@ -97,7 +97,7 @@ protected ClusterStatsNodeResponse newNodeResponse() {
}

@Override
protected ClusterStatsNodeResponse nodeOperation(ClusterStatsNodeRequest nodeRequest) throws ElasticsearchException {
protected ClusterStatsNodeResponse nodeOperation(ClusterStatsNodeRequest nodeRequest) {
NodeInfo nodeInfo = nodeService.info(false, true, false, true, false, false, true, false, true);
NodeStats nodeStats = nodeService.stats(CommonStatsFlags.NONE, false, true, true, false, false, true, false, false, false);
List<ShardStats> shardsStats = new ArrayList<>();
Expand Down
Expand Up @@ -62,7 +62,7 @@ protected PendingClusterTasksResponse newResponse() {
}

@Override
protected void masterOperation(PendingClusterTasksRequest request, ClusterState state, ActionListener<PendingClusterTasksResponse> listener) throws ElasticsearchException {
protected void masterOperation(PendingClusterTasksRequest request, ClusterState state, ActionListener<PendingClusterTasksResponse> listener) {
listener.onResponse(new PendingClusterTasksResponse(clusterService.pendingTasks()));
}
}
Expand Up @@ -20,7 +20,6 @@
package org.elasticsearch.action.admin.indices.alias;

import org.elasticsearch.ElasticsearchGenerationException;
import java.lang.IllegalArgumentException;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
Expand Down

0 comments on commit e34db4d

Please sign in to comment.