Skip to content

Commit

Permalink
fix: Fix NPE in DefaultRoutingService debug logging.
Browse files Browse the repository at this point in the history
- plus a small cleanup in PagingServiceFactory.
  • Loading branch information
t2gran committed Dec 12, 2023
1 parent 6d02184 commit 3278f21
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ public static PagingService createPagingService(
}

static Duration searchWindowOf(SearchParams searchParamsUsed) {
return searchParamsUsed == null || !searchParamsUsed.isSearchWindowSet()
? null
: Duration.ofSeconds(searchParamsUsed.searchWindowInSeconds());
if (searchParamsUsed == null || !searchParamsUsed.isSearchWindowSet()) {
return null;
}
return Duration.ofSeconds(searchParamsUsed.searchWindowInSeconds());
}

static Instant edt(Instant transitSearchStartTime, SearchParams searchParamsUsed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ public ViaRoutingResponse route(RouteViaRequest request) {

private void logResponse(RoutingResponse response) {
if (LOG.isDebugEnabled()) {
var m = response.getMetadata();
var text = MultiLineToStringBuilder
.of("Response")
.addDuration("SearchWindowUsed", response.getMetadata().searchWindowUsed)
.addDuration("SearchWindowUsed", m == null ? null : m.searchWindowUsed)
.add("NextPage", response.getNextPageCursor())
.add("PreviousPage", response.getPreviousPageCursor())
.addColNl(
Expand Down

0 comments on commit 3278f21

Please sign in to comment.