Skip to content

Commit

Permalink
Polish Status Codes
Browse files Browse the repository at this point in the history
Adjusted code styling to avoid nested ifs

Closes gh-11725
  • Loading branch information
jzheaux committed Mar 22, 2024
1 parent 6e45e65 commit 3f11622
Showing 1 changed file with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -414,26 +414,25 @@ public static Converter<ResponseToken, Saml2ResponseValidatorResult> createDefau

private static List<String> getStatusCodes(Response response) {
if (response.getStatus() == null) {
return Arrays.asList(StatusCode.SUCCESS);
return List.of(StatusCode.SUCCESS);
}
if (response.getStatus().getStatusCode() == null) {
return Arrays.asList(StatusCode.SUCCESS);
return List.of(StatusCode.SUCCESS);
}

StatusCode parentStatusCode = response.getStatus().getStatusCode();
String parentStatusCodeValue = parentStatusCode.getValue();
if (includeChildStatusCodes.contains(parentStatusCodeValue)) {
StatusCode statusCode = parentStatusCode.getStatusCode();
if (statusCode != null) {
String childStatusCodeValue = statusCode.getValue();
if (childStatusCodeValue != null) {
return Arrays.asList(parentStatusCodeValue, childStatusCodeValue);
}
}
return Arrays.asList(parentStatusCodeValue);
if (!includeChildStatusCodes.contains(parentStatusCodeValue)) {
return List.of(parentStatusCodeValue);
}

return Arrays.asList(parentStatusCodeValue);
StatusCode childStatusCode = parentStatusCode.getStatusCode();
if (childStatusCode == null) {
return List.of(parentStatusCodeValue);
}
String childStatusCodeValue = childStatusCode.getValue();
if (childStatusCodeValue == null) {
return List.of(parentStatusCodeValue);
}
return List.of(parentStatusCodeValue, childStatusCodeValue);
}

private static boolean isSuccess(List<String> statusCodes) {
Expand Down

0 comments on commit 3f11622

Please sign in to comment.