From b2be6e98ff1148677e8531c92e4912b505f52dc6 Mon Sep 17 00:00:00 2001 From: u$f Date: Mon, 3 Jul 2023 09:49:59 +0200 Subject: [PATCH] edit --- .../usf/traceapi/core/OutcomingRequestInterceptor.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/usf/traceapi/core/OutcomingRequestInterceptor.java b/src/main/java/org/usf/traceapi/core/OutcomingRequestInterceptor.java index 37bf013..2211808 100644 --- a/src/main/java/org/usf/traceapi/core/OutcomingRequestInterceptor.java +++ b/src/main/java/org/usf/traceapi/core/OutcomingRequestInterceptor.java @@ -2,7 +2,6 @@ import static java.lang.System.currentTimeMillis; import static java.time.Instant.ofEpochMilli; -import static java.util.Objects.isNull; import static java.util.Objects.nonNull; import static java.util.Optional.ofNullable; import static org.springframework.http.HttpHeaders.AUTHORIZATION; @@ -54,19 +53,17 @@ public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttp out.setStart(ofEpochMilli(beg)); out.setEnd(ofEpochMilli(fin)); out.setOutDataSize(nonNull(body) ? body.length : 0); - out.setThreadName(threadName()); if(nonNull(res)) { out.setStatus(res.getStatusCode().value()); out.setInDataSize(res.getBody().available()); //not exact !? out.setContentType(ofNullable(res.getHeaders().getContentType()).map(MediaType::getType).orElse(null)); } + out.setThreadName(threadName()); var trc = localTrace.get(); - if(isNull(trc)) { //no session - //orphan - } - else { + if(nonNull(trc)) { //no session trc.append(out); } + //else orphan } catch(Exception e) { //do not catch exception