Description
I noticed that sometimes Camel Kafka Connector prints this exception on the logs during AWS Kinesis tests. It seems to be related to trying to poll a stream when it is already removed.
2020-07-30 10:13:38,222 [/ckc-kin-stream] WARN org.apache.camel.component.aws.kinesis.KinesisConsumer - Consumer Consumer[aws-kinesis://ckc-kin-stream] failed polling endpoint: aws-kinesis://ckc-kin-stream. Will try again at next poll. Caused by: [java.lang.IndexOutOfBoundsException - Index 0 out of bounds for length 0] java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0 at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) ~[?:?] at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) ~[?:?] at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248) ~[?:?] at java.util.Objects.checkIndex(Objects.java:372) ~[?:?] at java.util.ArrayList.get(ArrayList.java:458) ~[?:?] at org.apache.camel.component.aws.kinesis.KinesisConsumer.getShardItertor(KinesisConsumer.java:132) ~[camel-aws-kinesis-3.4.2.jar:3.4.2] at org.apache.camel.component.aws.kinesis.KinesisConsumer.poll(KinesisConsumer.java:55) ~[camel-aws-kinesis-3.4.2.jar:3.4.2] at org.apache.camel.support.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187) [camel-support-3.4.2.jar:3.4.2] at org.apache.camel.support.ScheduledPollConsumer.run(ScheduledPollConsumer.java:106) [camel-support-3.4.2.jar:3.4.2] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at java.lang.Thread.run(Thread.java:834) [?:?]