From f1dd867c4f574e457eeca91cd842179725f2e010 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Thu, 4 Apr 2013 22:58:20 +0200 Subject: [PATCH] Catch Throwable when listener is called rather then Exception to prevent possible hangs if fatal exceptions or errors are thrown --- .../action/bulk/TransportBulkAction.java | 2 +- .../action/get/TransportMultiGetAction.java | 2 +- .../action/index/TransportIndexAction.java | 2 +- .../mlt/TransportMoreLikeThisAction.java | 4 ++-- .../search/TransportMultiSearchAction.java | 2 +- .../action/search/TransportSearchAction.java | 2 +- .../search/TransportSearchScrollAction.java | 4 ++-- ...ransportSearchDfsQueryThenFetchAction.java | 4 ++-- ...nsportSearchScrollQueryAndFetchAction.java | 2 +- ...sportSearchScrollQueryThenFetchAction.java | 2 +- .../type/TransportSearchTypeAction.java | 4 ++-- .../action/support/TransportAction.java | 4 ++-- .../TransportBroadcastOperationAction.java | 2 +- .../TransportMasterNodeOperationAction.java | 4 ++-- .../nodes/TransportNodesOperationAction.java | 6 +++--- ...nsportIndexReplicationOperationAction.java | 4 ++-- ...portIndicesReplicationOperationAction.java | 2 +- ...nsportShardReplicationOperationAction.java | 4 ++-- .../TransportSingleCustomOperationAction.java | 20 +++++++++---------- ...ransportInstanceSingleOperationAction.java | 4 ++-- .../TransportShardSingleOperationAction.java | 12 +++++------ .../action/update/TransportUpdateAction.java | 2 +- .../TransportClientNodesService.java | 2 +- .../metadata/MetaDataCreateIndexService.java | 2 +- .../metadata/MetaDataDeleteIndexService.java | 2 +- .../metadata/MetaDataIndexAliasesService.java | 2 +- .../MetaDataIndexTemplateService.java | 4 ++-- .../metadata/MetaDataMappingService.java | 6 +++--- .../MetaDataUpdateSettingsService.java | 2 +- .../common/util/SlicedLongList.java | 2 +- .../health/RestClusterHealthAction.java | 2 +- .../hotthreads/RestNodesHotThreadsAction.java | 2 +- .../node/info/RestNodesInfoAction.java | 2 +- .../node/restart/RestNodesRestartAction.java | 2 +- .../shutdown/RestNodesShutdownAction.java | 2 +- .../node/stats/RestNodesStatsAction.java | 2 +- .../reroute/RestClusterRerouteAction.java | 2 +- .../RestClusterGetSettingsAction.java | 2 +- .../RestClusterUpdateSettingsAction.java | 2 +- .../shards/RestClusterSearchShardsAction.java | 2 +- .../cluster/state/RestClusterStateAction.java | 2 +- .../alias/RestGetIndicesAliasesAction.java | 2 +- .../alias/RestIndicesAliasesAction.java | 2 +- .../indices/analyze/RestAnalyzeAction.java | 2 +- .../clear/RestClearIndicesCacheAction.java | 2 +- .../indices/create/RestCreateIndexAction.java | 2 +- .../indices/RestIndicesExistsAction.java | 2 +- .../exists/types/RestTypesExistsAction.java | 2 +- .../admin/indices/flush/RestFlushAction.java | 2 +- .../snapshot/RestGatewaySnapshotAction.java | 2 +- .../mapping/get/RestGetMappingAction.java | 2 +- .../indices/optimize/RestOptimizeAction.java | 2 +- .../indices/refresh/RestRefreshAction.java | 2 +- .../segments/RestIndicesSegmentsAction.java | 2 +- .../settings/RestGetSettingsAction.java | 2 +- .../settings/RestUpdateSettingsAction.java | 2 +- .../indices/stats/RestIndicesStatsAction.java | 20 +++++++++---------- .../status/RestIndicesStatusAction.java | 2 +- .../get/RestGetIndexTemplateAction.java | 2 +- .../query/RestValidateQueryAction.java | 2 +- .../warmer/get/RestGetWarmerAction.java | 2 +- .../rest/action/bulk/RestBulkAction.java | 2 +- .../rest/action/count/RestCountAction.java | 2 +- .../rest/action/delete/RestDeleteAction.java | 2 +- .../RestDeleteByQueryAction.java | 2 +- .../action/explain/RestExplainAction.java | 2 +- .../rest/action/get/RestGetAction.java | 2 +- .../rest/action/get/RestHeadAction.java | 2 +- .../rest/action/get/RestMultiGetAction.java | 2 +- .../rest/action/index/RestIndexAction.java | 2 +- .../rest/action/main/RestMainAction.java | 2 +- .../action/mlt/RestMoreLikeThisAction.java | 2 +- .../action/percolate/RestPercolateAction.java | 2 +- .../action/search/RestMultiSearchAction.java | 2 +- .../action/search/RestSearchScrollAction.java | 2 +- .../action/suggest/RestSuggestAction.java | 2 +- .../rest/action/update/RestUpdateAction.java | 2 +- 77 files changed, 114 insertions(+), 114 deletions(-) diff --git a/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java b/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java index 57ccc3a857d..2a06ae11340 100644 --- a/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java +++ b/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java @@ -274,7 +274,7 @@ public class TransportBulkAction extends TransportAction entry : request.customs.entrySet()) { templateBuilder.putCustom(entry.getKey(), entry.getValue()); } - } catch (Exception e) { + } catch (Throwable e) { listener.onFailure(e); return; } diff --git a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataMappingService.java b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataMappingService.java index 9d76533bdda..6c32a98c059 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataMappingService.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataMappingService.java @@ -203,7 +203,7 @@ public class MetaDataMappingService extends AbstractComponent { MetaData.Builder builder = newMetaDataBuilder().metaData(currentState.metaData()); builder.put(newIndexMetaDataBuilder(indexMetaData).putMapping(new MappingMetaData(updatedMapper))); return newClusterStateBuilder().state(currentState).metaData(builder).build(); - } catch (Exception e) { + } catch (Throwable e) { logger.warn("failed to dynamically update the mapping in cluster_state from shard", e); listener.onFailure(e); return currentState; @@ -256,7 +256,7 @@ public class MetaDataMappingService extends AbstractComponent { notifyOnPostProcess.set(true); return ClusterState.builder().state(currentState).metaData(builder).build(); - } catch (Exception e) { + } catch (Throwable e) { listener.onFailure(e); return currentState; } @@ -404,7 +404,7 @@ public class MetaDataMappingService extends AbstractComponent { } mappingCreatedAction.add(new CountDownListener(counter, listener), request.timeout); return updatedState; - } catch (Exception e) { + } catch (Throwable e) { listener.onFailure(e); return currentState; } finally { diff --git a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java index cd6be27cdf7..e9f46bb1986 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java @@ -265,7 +265,7 @@ public class MetaDataUpdateSettingsService extends AbstractComponent implements updatedState = newClusterStateBuilder().state(updatedState).routingResult(routingResult).build(); return updatedState; - } catch (Exception e) { + } catch (Throwable e) { listener.onFailure(e); return currentState; } diff --git a/src/main/java/org/elasticsearch/common/util/SlicedLongList.java b/src/main/java/org/elasticsearch/common/util/SlicedLongList.java index 5ab2f403dcc..5497d2aded5 100644 --- a/src/main/java/org/elasticsearch/common/util/SlicedLongList.java +++ b/src/main/java/org/elasticsearch/common/util/SlicedLongList.java @@ -26,7 +26,7 @@ import org.apache.lucene.util.LongsRef; import com.google.common.primitives.Longs; -public class SlicedLongList extends AbstractList implements RandomAccess { +public final class SlicedLongList extends AbstractList implements RandomAccess { public static final SlicedLongList EMPTY = new SlicedLongList(LongsRef.EMPTY_LONGS, 0, 0); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java index f4a518b5a83..1bc8d07300c 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java @@ -182,7 +182,7 @@ public class RestClusterHealthAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, status, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/hotthreads/RestNodesHotThreadsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/hotthreads/RestNodesHotThreadsAction.java index 769600e661f..546d8d2902d 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/hotthreads/RestNodesHotThreadsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/hotthreads/RestNodesHotThreadsAction.java @@ -70,7 +70,7 @@ public class RestNodesHotThreadsAction extends BaseRestHandler { sb.append('\n'); } channel.sendResponse(new StringRestResponse(RestStatus.OK, sb.toString())); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java index 335e9a90ecf..5107783dd26 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java @@ -114,7 +114,7 @@ public class RestNodesInfoAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/restart/RestNodesRestartAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/restart/RestNodesRestartAction.java index 6d8877dd628..01163eaf378 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/restart/RestNodesRestartAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/restart/RestNodesRestartAction.java @@ -70,7 +70,7 @@ public class RestNodesRestartAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/shutdown/RestNodesShutdownAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/shutdown/RestNodesShutdownAction.java index d1465224834..675b0f271a2 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/shutdown/RestNodesShutdownAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/shutdown/RestNodesShutdownAction.java @@ -73,7 +73,7 @@ public class RestNodesShutdownAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java index 6838fa5f195..880c5f6a173 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java @@ -136,7 +136,7 @@ public class RestNodesStatsAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java index 33d913e5c52..04895f914ba 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java @@ -82,7 +82,7 @@ public class RestClusterRerouteAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java index 48a30c04422..9f3cd8259f2 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java @@ -71,7 +71,7 @@ public class RestClusterGetSettingsAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java index a2e5552fd34..0ee1013d4ba 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java @@ -68,7 +68,7 @@ public class RestClusterUpdateSettingsAction extends BaseRestHandler { public void onResponse(ClusterUpdateSettingsResponse response) { try { channel.sendResponse(new StringRestResponse(RestStatus.OK)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/shards/RestClusterSearchShardsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/shards/RestClusterSearchShardsAction.java index 20a10de8ea8..2e3ef1d3ec3 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/shards/RestClusterSearchShardsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/shards/RestClusterSearchShardsAction.java @@ -76,7 +76,7 @@ public class RestClusterSearchShardsAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java index 7a13f07d7eb..b1ddc0ae5d5 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java @@ -74,7 +74,7 @@ public class RestClusterStateAction extends BaseRestHandler { response.getState().settingsFilter(settingsFilter).toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, RestStatus.OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestGetIndicesAliasesAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestGetIndicesAliasesAction.java index 19e4aa17e6c..a8b5920a5b0 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestGetIndicesAliasesAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestGetIndicesAliasesAction.java @@ -86,7 +86,7 @@ public class RestGetIndicesAliasesAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java index cdba81b0571..dc6f775ceee 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java @@ -162,7 +162,7 @@ public class RestIndicesAliasesAction extends BaseRestHandler { .field("acknowledged", response.isAcknowledged()) .endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java index 00c76fbc24e..8e99d0a9f16 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java @@ -81,7 +81,7 @@ public class RestAnalyzeAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java index ca9e5604be7..10ba32f291a 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java @@ -96,7 +96,7 @@ public class RestClearIndicesCacheAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java index be25063261c..d91699ad920 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java @@ -76,7 +76,7 @@ public class RestCreateIndexAction extends BaseRestHandler { .field("acknowledged", response.isAcknowledged()) .endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/indices/RestIndicesExistsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/indices/RestIndicesExistsAction.java index 608b976d391..164eb6412ab 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/indices/RestIndicesExistsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/indices/RestIndicesExistsAction.java @@ -63,7 +63,7 @@ public class RestIndicesExistsAction extends BaseRestHandler { } else { channel.sendResponse(new StringRestResponse(NOT_FOUND)); } - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/types/RestTypesExistsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/types/RestTypesExistsAction.java index d427680c153..1eb5002a71b 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/types/RestTypesExistsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/types/RestTypesExistsAction.java @@ -64,7 +64,7 @@ public class RestTypesExistsAction extends BaseRestHandler { } else { channel.sendResponse(new StringRestResponse(NOT_FOUND)); } - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java index 89c025ab327..3c8fb807200 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java @@ -82,7 +82,7 @@ public class RestFlushAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/gateway/snapshot/RestGatewaySnapshotAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/gateway/snapshot/RestGatewaySnapshotAction.java index 228b6452cba..f36fbc2d6d7 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/gateway/snapshot/RestGatewaySnapshotAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/gateway/snapshot/RestGatewaySnapshotAction.java @@ -68,7 +68,7 @@ public class RestGatewaySnapshotAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java index 26d6f870dd3..b1f0bb90c1f 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java @@ -129,7 +129,7 @@ public class RestGetMappingAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, foundAny || indices.length == 0 ? OK : NOT_FOUND, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java index f52d3268072..a43bbd65af2 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java @@ -96,7 +96,7 @@ public class RestOptimizeAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java index 8c8446ba97c..914153d36d9 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java @@ -79,7 +79,7 @@ public class RestRefreshAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java index a99cf174a86..0aa663085ab 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java @@ -73,7 +73,7 @@ public class RestIndicesSegmentsAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java index 79de9e14ce7..53c9a76e6bf 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java @@ -97,7 +97,7 @@ public class RestGetSettingsAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, foundAny ? OK : NOT_FOUND, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java index 47ab59f621f..80a16c08a12 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java @@ -97,7 +97,7 @@ public class RestUpdateSettingsAction extends BaseRestHandler { .field("ok", true) .endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java index 19c433c8862..17c495ea0b0 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java @@ -120,7 +120,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } @@ -157,7 +157,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } @@ -195,7 +195,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } @@ -239,7 +239,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } @@ -283,7 +283,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } @@ -320,7 +320,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } @@ -358,7 +358,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } @@ -396,7 +396,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } @@ -434,7 +434,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } @@ -472,7 +472,7 @@ public class RestIndicesStatsAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java index 854ea62aa7b..3ca0c45c6b4 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java @@ -82,7 +82,7 @@ public class RestIndicesStatusAction extends BaseRestHandler { response.toXContent(builder, request, settingsFilter); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java index 747c442cbca..cdbd5c5f5ec 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java @@ -109,7 +109,7 @@ public class RestGetIndexTemplateAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java index 53a7fd15c0f..e383b25e039 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java @@ -132,7 +132,7 @@ public class RestValidateQueryAction extends BaseRestHandler { } builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/get/RestGetWarmerAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/get/RestGetWarmerAction.java index d5a23d00b5a..adfe3bc3cd3 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/get/RestGetWarmerAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/get/RestGetWarmerAction.java @@ -121,7 +121,7 @@ public class RestGetWarmerAction extends BaseRestHandler { } channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java b/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java index a3ad98994b6..76b2e1ab33a 100644 --- a/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java +++ b/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java @@ -133,7 +133,7 @@ public class RestBulkAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java b/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java index dbc91142617..75a4d798367 100644 --- a/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java +++ b/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java @@ -112,7 +112,7 @@ public class RestCountAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java b/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java index afc9b0c890c..12fc50fdaaa 100644 --- a/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java +++ b/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java @@ -92,7 +92,7 @@ public class RestDeleteAction extends BaseRestHandler { status = NOT_FOUND; } channel.sendResponse(new XContentRestResponse(request, status, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java b/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java index fc4b241f0e0..f0abdab4ade 100644 --- a/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java +++ b/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java @@ -120,7 +120,7 @@ public class RestDeleteByQueryAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java b/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java index ffafde3680c..a65cee3f483 100644 --- a/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java +++ b/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java @@ -126,7 +126,7 @@ public class RestExplainAction extends BaseRestHandler { } builder.endObject(); channel.sendResponse(new XContentRestResponse(request, response.isExists() ? OK : NOT_FOUND, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java b/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java index 590e88d2a72..7e23f2ae614 100644 --- a/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java +++ b/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java @@ -79,7 +79,7 @@ public class RestGetAction extends BaseRestHandler { } else { channel.sendResponse(new XContentRestResponse(request, OK, builder)); } - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/get/RestHeadAction.java b/src/main/java/org/elasticsearch/rest/action/get/RestHeadAction.java index cccba25c1bc..c58b742911a 100644 --- a/src/main/java/org/elasticsearch/rest/action/get/RestHeadAction.java +++ b/src/main/java/org/elasticsearch/rest/action/get/RestHeadAction.java @@ -67,7 +67,7 @@ public class RestHeadAction extends BaseRestHandler { } else { channel.sendResponse(new StringRestResponse(OK)); } - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/get/RestMultiGetAction.java b/src/main/java/org/elasticsearch/rest/action/get/RestMultiGetAction.java index 77894872dec..2694ef3bc07 100644 --- a/src/main/java/org/elasticsearch/rest/action/get/RestMultiGetAction.java +++ b/src/main/java/org/elasticsearch/rest/action/get/RestMultiGetAction.java @@ -83,7 +83,7 @@ public class RestMultiGetAction extends BaseRestHandler { XContentBuilder builder = restContentBuilder(request); response.toXContent(builder, request); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java b/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java index 1827dd31a72..c89e8bb552f 100644 --- a/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java +++ b/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java @@ -128,7 +128,7 @@ public class RestIndexAction extends BaseRestHandler { status = CREATED; } channel.sendResponse(new XContentRestResponse(request, status, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java b/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java index bf8a656a1af..1112beab8f0 100644 --- a/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java +++ b/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java @@ -79,7 +79,7 @@ public class RestMainAction extends BaseRestHandler { builder.field("tagline", "You Know, for Search"); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, status, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java b/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java index e9702ae6eac..44b07d90c97 100644 --- a/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java +++ b/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java @@ -107,7 +107,7 @@ public class RestMoreLikeThisAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java b/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java index 1012524b9a0..8fbf4bbb80e 100644 --- a/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java @@ -77,7 +77,7 @@ public class RestPercolateAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java b/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java index 0438d56d7dd..02437287b5a 100644 --- a/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java +++ b/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java @@ -87,7 +87,7 @@ public class RestMultiSearchAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java b/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java index a4269d6c448..75f0b4d030f 100644 --- a/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java +++ b/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java @@ -93,7 +93,7 @@ public class RestSearchScrollAction extends BaseRestHandler { response.toXContent(builder, request); builder.endObject(); channel.sendResponse(new XContentRestResponse(request, response.status(), builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/suggest/RestSuggestAction.java b/src/main/java/org/elasticsearch/rest/action/suggest/RestSuggestAction.java index 15ea748d5d4..6c33ab06225 100644 --- a/src/main/java/org/elasticsearch/rest/action/suggest/RestSuggestAction.java +++ b/src/main/java/org/elasticsearch/rest/action/suggest/RestSuggestAction.java @@ -105,7 +105,7 @@ public class RestSuggestAction extends BaseRestHandler { } builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } } diff --git a/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java b/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java index dc264b5303d..b154fe8eec1 100644 --- a/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java @@ -153,7 +153,7 @@ public class RestUpdateAction extends BaseRestHandler { status = CREATED; } channel.sendResponse(new XContentRestResponse(request, status, builder)); - } catch (Exception e) { + } catch (Throwable e) { onFailure(e); } }