If listShards returns multiple pages, then we run into an infinite loop with while (!nextToken.isEmpty), because nextToken will never be set back to null because:
if (returnedToken != null) {
nextToken = returnedToken
listShards cannot allow both StreamName and NextToken to be specified together.
This fixes two bugs:
listShards
returns multiple pages, then we run into an infinite loop withwhile (!nextToken.isEmpty)
, becausenextToken
will never be set back tonull
because:listShards
cannot allow bothStreamName
andNextToken
to be specified together.