Empty role map throws java.util.NoSuchElementException
Opened this issue · 0 comments
misterzero commented
The following code threw this java.util.NoSuchElementException
:
okta-aws awsdev sts get-caller-identity
Username: xxx@acme.org
Password:
Exception in thread "main" java.util.NoSuchElementException
at java.base/java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:721)
at java.base/java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:751)
at java.base/java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:749)
at com.okta.tools.helpers.RoleHelper.chooseAwsRoleToAssume(RoleHelper.java:106)
at com.okta.tools.OktaAwsCliAssumeRole.doRequest(OktaAwsCliAssumeRole.java:133)
at com.okta.tools.OktaAwsCliAssumeRole.run(OktaAwsCliAssumeRole.java:102)
at com.okta.tools.WithOkta.main(WithOkta.java:30)
I need to figure out why I did not have any roles available, however it would save troubleshooting time to provide a more clear error message like:
} else if (roleIdpPairs.size() < 1) {
throw new NoSuchElementException("No roles available for this user")
} else {
...