-
Notifications
You must be signed in to change notification settings - Fork 594
HDDS-14472. [STS] Refactor constants and validation methods to shared location #9658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
f54a718 to
b17e2b9
Compare
update unit tests
| final int roleSessionNameLength = roleSessionName.length(); | ||
| if (roleSessionNameLength < ASSUME_ROLE_SESSION_NAME_MIN_LENGTH || | ||
| roleSessionNameLength > ASSUME_ROLE_SESSION_NAME_MAX_LENGTH) { | ||
| throw new OMException("Invalid RoleSessionName: must be " + ASSUME_ROLE_SESSION_NAME_MIN_LENGTH + "-" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we know the problem is that the length is outside bounds. In the loop below we know the length bounds are fine (as it passed this check), buts its checking characters. Should be adjust the error messages in both cases to make it more clear that the problem is length in this case and bad characters in the other case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
| for (int i = 0; i < roleSessionNameLength; i++) { | ||
| final char c = roleSessionName.charAt(i); | ||
| if (!isRoleSessionNameChar(c)) { | ||
| throw new OMException("Invalid RoleSessionName: must be " + ASSUME_ROLE_SESSION_NAME_MIN_LENGTH + "-" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this error, we have the character which is at fault, so we could add it to the error message to make it a little bit more helpful "Invalid character '" + c + "' in RoleSessionName ..... "
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
sodonnel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a couple of minor comments, otherwise looks good.
Please describe your PR in detail:
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-14472
How was this patch tested?
unit tests and smoke tests