Polish Status Codes

Adjusted code styling to avoid nested ifs

Closes gh-11725
This commit is contained in:
Josh Cummings 2024-03-22 11:24:55 -06:00
parent 6e45e65cac
commit 3f11622687
No known key found for this signature in database
GPG Key ID: A306A51F43B8E5A5
1 changed files with 13 additions and 14 deletions

View File

@ -414,26 +414,25 @@ public final class OpenSaml4AuthenticationProvider implements AuthenticationProv
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) {