Add clarifying comment on removing an ElasticsearchException

This commit is contained in:
Jason Tedor 2015-09-25 14:54:29 -04:00
parent ab19bfbe9b
commit 75ecc54f33
2 changed files with 157 additions and 147 deletions

View File

@ -454,11 +454,12 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
} }
enum ElasticsearchExceptionHandle { 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 // 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 // to deserialize the exception coming from another node or from an corruption marker on
// a corrupted index. // 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), 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), 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), EXECUTION_CANCELLED_EXCEPTION(org.elasticsearch.common.util.CancellableThreads.ExecutionCancelledException.class, org.elasticsearch.common.util.CancellableThreads.ExecutionCancelledException::new, 2),

View File

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