diff --git a/core/src/main/java/org/elasticsearch/ElasticsearchException.java b/core/src/main/java/org/elasticsearch/ElasticsearchException.java index d9ac0003a8e..4804dd56b11 100644 --- a/core/src/main/java/org/elasticsearch/ElasticsearchException.java +++ b/core/src/main/java/org/elasticsearch/ElasticsearchException.java @@ -454,11 +454,12 @@ public class ElasticsearchException extends RuntimeException implements ToXConte } enum ElasticsearchExceptionHandle { - // each exception gets an ordinal assigned that must never change. While the exception name can + // each exception gets an assigned id that must never change. While the exception name can // change due to refactorings etc. like renaming we have to keep the ordinal <--> class mapping // to deserialize the exception coming from another node or from an corruption marker on // a corrupted index. - // NOTE: ONLY APPEND TO THE END and NEVER REMOVE EXCEPTIONS IN MINOR VERSIONS + // these exceptions can be ordered and removed, but (repeating) the ids must never change + // to remove an exception, remove the enum value below, and mark the id as null in ExceptionSerializationTests.testIds.ids INDEX_SHARD_SNAPSHOT_FAILED_EXCEPTION(org.elasticsearch.index.snapshots.IndexShardSnapshotFailedException.class, org.elasticsearch.index.snapshots.IndexShardSnapshotFailedException::new, 0), DFS_PHASE_EXECUTION_EXCEPTION(org.elasticsearch.search.dfs.DfsPhaseExecutionException.class, org.elasticsearch.search.dfs.DfsPhaseExecutionException::new, 1), EXECUTION_CANCELLED_EXCEPTION(org.elasticsearch.common.util.CancellableThreads.ExecutionCancelledException.class, org.elasticsearch.common.util.CancellableThreads.ExecutionCancelledException::new, 2), diff --git a/core/src/test/java/org/elasticsearch/ExceptionSerializationTests.java b/core/src/test/java/org/elasticsearch/ExceptionSerializationTests.java index b0e8c19ebf1..2ad930e67ba 100644 --- a/core/src/test/java/org/elasticsearch/ExceptionSerializationTests.java +++ b/core/src/test/java/org/elasticsearch/ExceptionSerializationTests.java @@ -656,154 +656,163 @@ public class ExceptionSerializationTests extends ESTestCase { } public void testIds() { - Map, Integer> ids = new HashMap<>(); - ids.put(org.elasticsearch.index.snapshots.IndexShardSnapshotFailedException.class, 0); - ids.put(org.elasticsearch.search.dfs.DfsPhaseExecutionException.class, 1); - ids.put(org.elasticsearch.common.util.CancellableThreads.ExecutionCancelledException.class, 2); - ids.put(org.elasticsearch.discovery.MasterNotDiscoveredException.class, 3); - ids.put(org.elasticsearch.ElasticsearchSecurityException.class, 4); - ids.put(org.elasticsearch.index.snapshots.IndexShardRestoreException.class, 5); - ids.put(org.elasticsearch.indices.IndexClosedException.class, 6); - ids.put(org.elasticsearch.http.BindHttpException.class, 7); - ids.put(org.elasticsearch.action.search.ReduceSearchPhaseException.class, 8); - ids.put(org.elasticsearch.node.NodeClosedException.class, 9); - ids.put(org.elasticsearch.index.engine.SnapshotFailedEngineException.class, 10); - ids.put(org.elasticsearch.index.shard.ShardNotFoundException.class, 11); - ids.put(org.elasticsearch.transport.ConnectTransportException.class, 12); - ids.put(org.elasticsearch.transport.NotSerializableTransportException.class, 13); - ids.put(org.elasticsearch.transport.ResponseHandlerFailureTransportException.class, 14); - ids.put(org.elasticsearch.indices.IndexCreationException.class, 15); - ids.put(org.elasticsearch.index.IndexNotFoundException.class, 16); - ids.put(org.elasticsearch.cluster.routing.IllegalShardRoutingStateException.class, 17); - ids.put(org.elasticsearch.action.support.broadcast.BroadcastShardOperationFailedException.class, 18); - ids.put(org.elasticsearch.ResourceNotFoundException.class, 19); - ids.put(org.elasticsearch.transport.ActionTransportException.class, 20); - ids.put(org.elasticsearch.ElasticsearchGenerationException.class, 21); - ids.put(org.elasticsearch.index.engine.CreateFailedEngineException.class, 22); - ids.put(org.elasticsearch.index.shard.IndexShardStartedException.class, 23); - ids.put(org.elasticsearch.search.SearchContextMissingException.class, 24); - ids.put(org.elasticsearch.script.ScriptException.class, 25); - ids.put(org.elasticsearch.index.shard.TranslogRecoveryPerformer.BatchOperationException.class, 26); - ids.put(org.elasticsearch.snapshots.SnapshotCreationException.class, 27); - ids.put(org.elasticsearch.index.engine.DeleteFailedEngineException.class, 28); - ids.put(org.elasticsearch.index.engine.DocumentMissingException.class, 29); - ids.put(org.elasticsearch.snapshots.SnapshotException.class, 30); - ids.put(org.elasticsearch.indices.InvalidAliasNameException.class, 31); - ids.put(org.elasticsearch.indices.InvalidIndexNameException.class, 32); - ids.put(org.elasticsearch.indices.IndexPrimaryShardNotAllocatedException.class, 33); - ids.put(org.elasticsearch.transport.TransportException.class, 34); - ids.put(org.elasticsearch.ElasticsearchParseException.class, 35); - ids.put(org.elasticsearch.search.SearchException.class, 36); - ids.put(org.elasticsearch.index.mapper.MapperException.class, 37); - ids.put(org.elasticsearch.indices.InvalidTypeNameException.class, 38); - ids.put(org.elasticsearch.snapshots.SnapshotRestoreException.class, 39); - ids.put(org.elasticsearch.common.ParsingException.class, 40); - ids.put(org.elasticsearch.index.shard.IndexShardClosedException.class, 41); - ids.put(org.elasticsearch.indices.recovery.RecoverFilesRecoveryException.class, 42); - ids.put(org.elasticsearch.index.translog.TruncatedTranslogException.class, 43); - ids.put(org.elasticsearch.indices.recovery.RecoveryFailedException.class, 44); - ids.put(org.elasticsearch.index.shard.IndexShardRelocatedException.class, 45); - ids.put(org.elasticsearch.transport.NodeShouldNotConnectException.class, 46); - ids.put(org.elasticsearch.indices.IndexTemplateAlreadyExistsException.class, 47); - ids.put(org.elasticsearch.index.translog.TranslogCorruptedException.class, 48); - ids.put(org.elasticsearch.cluster.block.ClusterBlockException.class, 49); - ids.put(org.elasticsearch.search.fetch.FetchPhaseExecutionException.class, 50); - ids.put(org.elasticsearch.index.IndexShardAlreadyExistsException.class, 51); - ids.put(org.elasticsearch.index.engine.VersionConflictEngineException.class, 52); - ids.put(org.elasticsearch.index.engine.EngineException.class, 53); - ids.put(org.elasticsearch.index.engine.DocumentAlreadyExistsException.class, 54); - ids.put(org.elasticsearch.action.NoSuchNodeException.class, 55); - ids.put(org.elasticsearch.common.settings.SettingsException.class, 56); - ids.put(org.elasticsearch.indices.IndexTemplateMissingException.class, 57); - ids.put(org.elasticsearch.transport.SendRequestTransportException.class, 58); - ids.put(org.elasticsearch.common.util.concurrent.EsRejectedExecutionException.class, 59); - ids.put(org.elasticsearch.common.lucene.Lucene.EarlyTerminationException.class, 60); - ids.put(org.elasticsearch.cluster.routing.RoutingValidationException.class, 61); - ids.put(org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper.class, 62); - ids.put(org.elasticsearch.indices.AliasFilterParsingException.class, 63); - ids.put(org.elasticsearch.index.engine.DeleteByQueryFailedEngineException.class, 64); - ids.put(org.elasticsearch.gateway.GatewayException.class, 65); - ids.put(org.elasticsearch.index.shard.IndexShardNotRecoveringException.class, 66); - ids.put(org.elasticsearch.http.HttpException.class, 67); - ids.put(org.elasticsearch.ElasticsearchException.class, 68); - ids.put(org.elasticsearch.snapshots.SnapshotMissingException.class, 69); - ids.put(org.elasticsearch.action.PrimaryMissingActionException.class, 70); - ids.put(org.elasticsearch.action.FailedNodeException.class, 71); - ids.put(org.elasticsearch.search.SearchParseException.class, 72); - ids.put(org.elasticsearch.snapshots.ConcurrentSnapshotExecutionException.class, 73); - ids.put(org.elasticsearch.common.blobstore.BlobStoreException.class, 74); - ids.put(org.elasticsearch.cluster.IncompatibleClusterStateVersionException.class, 75); - ids.put(org.elasticsearch.index.engine.RecoveryEngineException.class, 76); - ids.put(org.elasticsearch.common.util.concurrent.UncategorizedExecutionException.class, 77); - ids.put(org.elasticsearch.action.TimestampParsingException.class, 78); - ids.put(org.elasticsearch.action.RoutingMissingException.class, 79); - ids.put(org.elasticsearch.index.engine.IndexFailedEngineException.class, 80); - ids.put(org.elasticsearch.index.snapshots.IndexShardRestoreFailedException.class, 81); - ids.put(org.elasticsearch.repositories.RepositoryException.class, 82); - ids.put(org.elasticsearch.transport.ReceiveTimeoutTransportException.class, 83); - ids.put(org.elasticsearch.transport.NodeDisconnectedException.class, 84); - ids.put(org.elasticsearch.index.AlreadyExpiredException.class, 85); - ids.put(org.elasticsearch.search.aggregations.AggregationExecutionException.class, 86); - ids.put(org.elasticsearch.index.mapper.MergeMappingException.class, 87); - ids.put(org.elasticsearch.indices.InvalidIndexTemplateException.class, 88); - ids.put(org.elasticsearch.percolator.PercolateException.class, 89); - ids.put(org.elasticsearch.index.engine.RefreshFailedEngineException.class, 90); - ids.put(org.elasticsearch.search.aggregations.AggregationInitializationException.class, 91); - ids.put(org.elasticsearch.indices.recovery.DelayRecoveryException.class, 92); - ids.put(org.elasticsearch.search.warmer.IndexWarmerMissingException.class, 93); - ids.put(org.elasticsearch.client.transport.NoNodeAvailableException.class, 94); - ids.put(org.elasticsearch.script.groovy.GroovyScriptCompilationException.class, 95); - ids.put(org.elasticsearch.snapshots.InvalidSnapshotNameException.class, 96); - ids.put(org.elasticsearch.index.shard.IllegalIndexShardStateException.class, 97); - ids.put(org.elasticsearch.index.snapshots.IndexShardSnapshotException.class, 98); - ids.put(org.elasticsearch.index.shard.IndexShardNotStartedException.class, 99); - ids.put(org.elasticsearch.action.search.SearchPhaseExecutionException.class, 100); - ids.put(org.elasticsearch.transport.ActionNotFoundTransportException.class, 101); - ids.put(org.elasticsearch.transport.TransportSerializationException.class, 102); - ids.put(org.elasticsearch.transport.RemoteTransportException.class, 103); - ids.put(org.elasticsearch.index.engine.EngineCreationFailureException.class, 104); - ids.put(org.elasticsearch.cluster.routing.RoutingException.class, 105); - ids.put(org.elasticsearch.index.shard.IndexShardRecoveryException.class, 106); - ids.put(org.elasticsearch.repositories.RepositoryMissingException.class, 107); - ids.put(org.elasticsearch.index.percolator.PercolatorException.class, 108); - ids.put(org.elasticsearch.index.engine.DocumentSourceMissingException.class, 109); - ids.put(org.elasticsearch.index.engine.FlushNotAllowedEngineException.class, 110); - ids.put(org.elasticsearch.common.settings.NoClassSettingsException.class, 111); - ids.put(org.elasticsearch.transport.BindTransportException.class, 112); - ids.put(org.elasticsearch.rest.action.admin.indices.alias.delete.AliasesNotFoundException.class, 113); - ids.put(org.elasticsearch.index.shard.IndexShardRecoveringException.class, 114); - ids.put(org.elasticsearch.index.translog.TranslogException.class, 115); - ids.put(org.elasticsearch.cluster.metadata.ProcessClusterEventTimeoutException.class, 116); - ids.put(org.elasticsearch.action.support.replication.TransportReplicationAction.RetryOnPrimaryException.class, 117); - ids.put(org.elasticsearch.ElasticsearchTimeoutException.class, 118); - ids.put(org.elasticsearch.search.query.QueryPhaseExecutionException.class, 119); - ids.put(org.elasticsearch.repositories.RepositoryVerificationException.class, 120); - ids.put(org.elasticsearch.search.aggregations.InvalidAggregationPathException.class, 121); - ids.put(org.elasticsearch.script.groovy.GroovyScriptExecutionException.class, 122); - ids.put(org.elasticsearch.indices.IndexAlreadyExistsException.class, 123); - ids.put(org.elasticsearch.script.Script.ScriptParseException.class, 124); - ids.put(org.elasticsearch.transport.netty.SizeHeaderFrameDecoder.HttpOnTransportException.class, 125); - ids.put(org.elasticsearch.index.mapper.MapperParsingException.class, 126); - ids.put(org.elasticsearch.search.SearchContextException.class, 127); - ids.put(org.elasticsearch.search.builder.SearchSourceBuilderException.class, 128); - ids.put(org.elasticsearch.index.engine.EngineClosedException.class, 129); - ids.put(org.elasticsearch.action.NoShardAvailableActionException.class, 130); - ids.put(org.elasticsearch.action.UnavailableShardsException.class, 131); - ids.put(org.elasticsearch.index.engine.FlushFailedEngineException.class, 132); - ids.put(org.elasticsearch.common.breaker.CircuitBreakingException.class, 133); - ids.put(org.elasticsearch.transport.NodeNotConnectedException.class, 134); - ids.put(org.elasticsearch.index.mapper.StrictDynamicMappingException.class, 135); - ids.put(org.elasticsearch.action.support.replication.TransportReplicationAction.RetryOnReplicaException.class, 136); - ids.put(org.elasticsearch.indices.TypeMissingException.class, 137); - ids.put(org.elasticsearch.discovery.Discovery.FailedToCommitClusterStateException.class, 138); - ids.put(org.elasticsearch.index.query.QueryShardException.class, 139); + Map> ids = new HashMap<>(); + ids.put(0, org.elasticsearch.index.snapshots.IndexShardSnapshotFailedException.class); + ids.put(1, org.elasticsearch.search.dfs.DfsPhaseExecutionException.class); + ids.put(2, org.elasticsearch.common.util.CancellableThreads.ExecutionCancelledException.class); + ids.put(3, org.elasticsearch.discovery.MasterNotDiscoveredException.class); + ids.put(4, org.elasticsearch.ElasticsearchSecurityException.class); + ids.put(5, org.elasticsearch.index.snapshots.IndexShardRestoreException.class); + ids.put(6, org.elasticsearch.indices.IndexClosedException.class); + ids.put(7, org.elasticsearch.http.BindHttpException.class); + ids.put(8, org.elasticsearch.action.search.ReduceSearchPhaseException.class); + ids.put(9, org.elasticsearch.node.NodeClosedException.class); + ids.put(10, org.elasticsearch.index.engine.SnapshotFailedEngineException.class); + ids.put(11, org.elasticsearch.index.shard.ShardNotFoundException.class); + ids.put(12, org.elasticsearch.transport.ConnectTransportException.class); + ids.put(13, org.elasticsearch.transport.NotSerializableTransportException.class); + ids.put(14, org.elasticsearch.transport.ResponseHandlerFailureTransportException.class); + ids.put(15, org.elasticsearch.indices.IndexCreationException.class); + ids.put(16, org.elasticsearch.index.IndexNotFoundException.class); + ids.put(17, org.elasticsearch.cluster.routing.IllegalShardRoutingStateException.class); + ids.put(18, org.elasticsearch.action.support.broadcast.BroadcastShardOperationFailedException.class); + ids.put(19, org.elasticsearch.ResourceNotFoundException.class); + ids.put(20, org.elasticsearch.transport.ActionTransportException.class); + ids.put(21, org.elasticsearch.ElasticsearchGenerationException.class); + ids.put(22, org.elasticsearch.index.engine.CreateFailedEngineException.class); + ids.put(23, org.elasticsearch.index.shard.IndexShardStartedException.class); + ids.put(24, org.elasticsearch.search.SearchContextMissingException.class); + ids.put(25, org.elasticsearch.script.ScriptException.class); + ids.put(26, org.elasticsearch.index.shard.TranslogRecoveryPerformer.BatchOperationException.class); + ids.put(27, org.elasticsearch.snapshots.SnapshotCreationException.class); + ids.put(28, org.elasticsearch.index.engine.DeleteFailedEngineException.class); + ids.put(29, org.elasticsearch.index.engine.DocumentMissingException.class); + ids.put(30, org.elasticsearch.snapshots.SnapshotException.class); + ids.put(31, org.elasticsearch.indices.InvalidAliasNameException.class); + ids.put(32, org.elasticsearch.indices.InvalidIndexNameException.class); + ids.put(33, org.elasticsearch.indices.IndexPrimaryShardNotAllocatedException.class); + ids.put(34, org.elasticsearch.transport.TransportException.class); + ids.put(35, org.elasticsearch.ElasticsearchParseException.class); + ids.put(36, org.elasticsearch.search.SearchException.class); + ids.put(37, org.elasticsearch.index.mapper.MapperException.class); + ids.put(38, org.elasticsearch.indices.InvalidTypeNameException.class); + ids.put(39, org.elasticsearch.snapshots.SnapshotRestoreException.class); + ids.put(40, org.elasticsearch.common.ParsingException.class); + ids.put(41, org.elasticsearch.index.shard.IndexShardClosedException.class); + ids.put(42, org.elasticsearch.indices.recovery.RecoverFilesRecoveryException.class); + ids.put(43, org.elasticsearch.index.translog.TruncatedTranslogException.class); + ids.put(44, org.elasticsearch.indices.recovery.RecoveryFailedException.class); + ids.put(45, org.elasticsearch.index.shard.IndexShardRelocatedException.class); + ids.put(46, org.elasticsearch.transport.NodeShouldNotConnectException.class); + ids.put(47, org.elasticsearch.indices.IndexTemplateAlreadyExistsException.class); + ids.put(48, org.elasticsearch.index.translog.TranslogCorruptedException.class); + ids.put(49, org.elasticsearch.cluster.block.ClusterBlockException.class); + ids.put(50, org.elasticsearch.search.fetch.FetchPhaseExecutionException.class); + ids.put(51, org.elasticsearch.index.IndexShardAlreadyExistsException.class); + ids.put(52, org.elasticsearch.index.engine.VersionConflictEngineException.class); + ids.put(53, org.elasticsearch.index.engine.EngineException.class); + ids.put(54, org.elasticsearch.index.engine.DocumentAlreadyExistsException.class); + ids.put(55, org.elasticsearch.action.NoSuchNodeException.class); + ids.put(56, org.elasticsearch.common.settings.SettingsException.class); + ids.put(57, org.elasticsearch.indices.IndexTemplateMissingException.class); + ids.put(58, org.elasticsearch.transport.SendRequestTransportException.class); + ids.put(59, org.elasticsearch.common.util.concurrent.EsRejectedExecutionException.class); + ids.put(60, org.elasticsearch.common.lucene.Lucene.EarlyTerminationException.class); + ids.put(61, org.elasticsearch.cluster.routing.RoutingValidationException.class); + ids.put(62, org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper.class); + ids.put(63, org.elasticsearch.indices.AliasFilterParsingException.class); + ids.put(64, org.elasticsearch.index.engine.DeleteByQueryFailedEngineException.class); + ids.put(65, org.elasticsearch.gateway.GatewayException.class); + ids.put(66, org.elasticsearch.index.shard.IndexShardNotRecoveringException.class); + ids.put(67, org.elasticsearch.http.HttpException.class); + ids.put(68, org.elasticsearch.ElasticsearchException.class); + ids.put(69, org.elasticsearch.snapshots.SnapshotMissingException.class); + ids.put(70, org.elasticsearch.action.PrimaryMissingActionException.class); + ids.put(71, org.elasticsearch.action.FailedNodeException.class); + ids.put(72, org.elasticsearch.search.SearchParseException.class); + ids.put(73, org.elasticsearch.snapshots.ConcurrentSnapshotExecutionException.class); + ids.put(74, org.elasticsearch.common.blobstore.BlobStoreException.class); + ids.put(75, org.elasticsearch.cluster.IncompatibleClusterStateVersionException.class); + ids.put(76, org.elasticsearch.index.engine.RecoveryEngineException.class); + ids.put(77, org.elasticsearch.common.util.concurrent.UncategorizedExecutionException.class); + ids.put(78, org.elasticsearch.action.TimestampParsingException.class); + ids.put(79, org.elasticsearch.action.RoutingMissingException.class); + ids.put(80, org.elasticsearch.index.engine.IndexFailedEngineException.class); + ids.put(81, org.elasticsearch.index.snapshots.IndexShardRestoreFailedException.class); + ids.put(82, org.elasticsearch.repositories.RepositoryException.class); + ids.put(83, org.elasticsearch.transport.ReceiveTimeoutTransportException.class); + ids.put(84, org.elasticsearch.transport.NodeDisconnectedException.class); + ids.put(85, org.elasticsearch.index.AlreadyExpiredException.class); + ids.put(86, org.elasticsearch.search.aggregations.AggregationExecutionException.class); + ids.put(87, org.elasticsearch.index.mapper.MergeMappingException.class); + ids.put(88, org.elasticsearch.indices.InvalidIndexTemplateException.class); + ids.put(89, org.elasticsearch.percolator.PercolateException.class); + ids.put(90, org.elasticsearch.index.engine.RefreshFailedEngineException.class); + ids.put(91, org.elasticsearch.search.aggregations.AggregationInitializationException.class); + ids.put(92, org.elasticsearch.indices.recovery.DelayRecoveryException.class); + ids.put(93, org.elasticsearch.search.warmer.IndexWarmerMissingException.class); + ids.put(94, org.elasticsearch.client.transport.NoNodeAvailableException.class); + ids.put(95, org.elasticsearch.script.groovy.GroovyScriptCompilationException.class); + ids.put(96, org.elasticsearch.snapshots.InvalidSnapshotNameException.class); + ids.put(97, org.elasticsearch.index.shard.IllegalIndexShardStateException.class); + ids.put(98, org.elasticsearch.index.snapshots.IndexShardSnapshotException.class); + ids.put(99, org.elasticsearch.index.shard.IndexShardNotStartedException.class); + ids.put(100, org.elasticsearch.action.search.SearchPhaseExecutionException.class); + ids.put(101, org.elasticsearch.transport.ActionNotFoundTransportException.class); + ids.put(102, org.elasticsearch.transport.TransportSerializationException.class); + ids.put(103, org.elasticsearch.transport.RemoteTransportException.class); + ids.put(104, org.elasticsearch.index.engine.EngineCreationFailureException.class); + ids.put(105, org.elasticsearch.cluster.routing.RoutingException.class); + ids.put(106, org.elasticsearch.index.shard.IndexShardRecoveryException.class); + ids.put(107, org.elasticsearch.repositories.RepositoryMissingException.class); + ids.put(108, org.elasticsearch.index.percolator.PercolatorException.class); + ids.put(109, org.elasticsearch.index.engine.DocumentSourceMissingException.class); + ids.put(110, org.elasticsearch.index.engine.FlushNotAllowedEngineException.class); + ids.put(111, org.elasticsearch.common.settings.NoClassSettingsException.class); + ids.put(112, org.elasticsearch.transport.BindTransportException.class); + ids.put(113, org.elasticsearch.rest.action.admin.indices.alias.delete.AliasesNotFoundException.class); + ids.put(114, org.elasticsearch.index.shard.IndexShardRecoveringException.class); + ids.put(115, org.elasticsearch.index.translog.TranslogException.class); + ids.put(116, org.elasticsearch.cluster.metadata.ProcessClusterEventTimeoutException.class); + ids.put(117, org.elasticsearch.action.support.replication.TransportReplicationAction.RetryOnPrimaryException.class); + ids.put(118, org.elasticsearch.ElasticsearchTimeoutException.class); + ids.put(119, org.elasticsearch.search.query.QueryPhaseExecutionException.class); + ids.put(120, org.elasticsearch.repositories.RepositoryVerificationException.class); + ids.put(121, org.elasticsearch.search.aggregations.InvalidAggregationPathException.class); + ids.put(122, org.elasticsearch.script.groovy.GroovyScriptExecutionException.class); + ids.put(123, org.elasticsearch.indices.IndexAlreadyExistsException.class); + ids.put(124, org.elasticsearch.script.Script.ScriptParseException.class); + ids.put(125, org.elasticsearch.transport.netty.SizeHeaderFrameDecoder.HttpOnTransportException.class); + ids.put(126, org.elasticsearch.index.mapper.MapperParsingException.class); + ids.put(127, org.elasticsearch.search.SearchContextException.class); + ids.put(128, org.elasticsearch.search.builder.SearchSourceBuilderException.class); + ids.put(129, org.elasticsearch.index.engine.EngineClosedException.class); + ids.put(130, org.elasticsearch.action.NoShardAvailableActionException.class); + ids.put(131, org.elasticsearch.action.UnavailableShardsException.class); + ids.put(132, org.elasticsearch.index.engine.FlushFailedEngineException.class); + ids.put(133, org.elasticsearch.common.breaker.CircuitBreakingException.class); + ids.put(134, org.elasticsearch.transport.NodeNotConnectedException.class); + ids.put(135, org.elasticsearch.index.mapper.StrictDynamicMappingException.class); + ids.put(136, org.elasticsearch.action.support.replication.TransportReplicationAction.RetryOnReplicaException.class); + ids.put(137, org.elasticsearch.indices.TypeMissingException.class); + ids.put(138, org.elasticsearch.discovery.Discovery.FailedToCommitClusterStateException.class); + ids.put(139, org.elasticsearch.index.query.QueryShardException.class); - for (ElasticsearchException.ElasticsearchExceptionHandle handle : ElasticsearchException.ElasticsearchExceptionHandle.values()) { - assertEquals((int)ids.get(handle.exceptionClass), handle.id); + Map, Integer> reverse = new HashMap<>(); + for (Map.Entry> entry : ids.entrySet()) { + if (entry.getValue() != null) { + reverse.put(entry.getValue(), entry.getKey()); + } } - for (Map.Entry, Integer> entry : ids.entrySet()) { - assertEquals((int)entry.getValue(), ElasticsearchException.getId(entry.getKey())); + for (ElasticsearchException.ElasticsearchExceptionHandle handle : ElasticsearchException.ElasticsearchExceptionHandle.values()) { + assertEquals((int)reverse.get(handle.exceptionClass), handle.id); + } + + for (Map.Entry> entry : ids.entrySet()) { + if (entry.getValue() != null) { + assertEquals((int) entry.getKey(), ElasticsearchException.getId(entry.getValue())); + } } } }