Skip to content

Commit

Permalink
chore: fixes NPE in case of unfavorable SD entries and improves loggi…
Browse files Browse the repository at this point in the history
…ng to find a hidden exceptions
  • Loading branch information
jekutzsche committed May 5, 2022
1 parent 41f56d1 commit 9c2857d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.util.List;
import java.util.Objects;
import java.util.Set;

import javax.validation.Valid;
Expand Down Expand Up @@ -43,6 +44,7 @@ public Apps getAvailableApps() {
return epsRpcClient.invoke(methodName, null, Directory.class).entries().stream()
.filter(directoryEntry -> directoryEntry.groups().contains("checkin-apps"))
.map(DirectoryEntry::name)
.filter(Objects::nonNull)
.map(App::new)
.collect(collectingAndThen(toList(), Apps::new));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import iris.client_bff.status.web.AppStatusController.AppStatusInfo.Info;
import lombok.AllArgsConstructor;
import lombok.Value;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

Expand All @@ -27,6 +28,7 @@
@RequestMapping("/status/checkin-apps")
@Validated
@AllArgsConstructor
@Slf4j
public class AppStatusController {

private StatusService statusService;
Expand All @@ -37,6 +39,9 @@ public List<App> getApps() {
try {
return statusService.getApps().toList();
} catch (Exception e) {

log.error("Can't get apps from StatusService: ", e);

throw new ResponseStatusException(HttpStatus.BAD_REQUEST, e.getMessage());
}
}
Expand Down

0 comments on commit 9c2857d

Please sign in to comment.