From 2b98b11c12122dafd1db2dccb7e5766409cfd256 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 18 Apr 2018 09:38:38 +0200 Subject: [PATCH] Polish "Less object instantiation in WebMvcTags" Closes gh-12894 --- .../boot/actuate/metrics/web/servlet/WebMvcTags.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcTags.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcTags.java index dad8370a637..3c79fe9d737 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcTags.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcTags.java @@ -58,7 +58,7 @@ public final class WebMvcTags { * @return the method tag whose value is a capitalized method (e.g. GET). */ public static Tag method(HttpServletRequest request) { - return request == null ? METHOD_UNKNOWN : Tag.of("method", request.getMethod()); + return (request == null ? METHOD_UNKNOWN : Tag.of("method", request.getMethod())); } /** @@ -67,8 +67,8 @@ public final class WebMvcTags { * @return the status tag derived from the status of the response */ public static Tag status(HttpServletResponse response) { - return response == null ? STATUS_UNKNOWN : - Tag.of("status", Integer.toString(response.getStatus())); + return (response == null ? STATUS_UNKNOWN : + Tag.of("status", Integer.toString(response.getStatus()))); } /** @@ -128,8 +128,9 @@ public final class WebMvcTags { * @return the exception tag derived from the exception */ public static Tag exception(Throwable exception) { - return exception == null ? EXCEPTION_NONE : - Tag.of("exception", exception.getClass().getSimpleName()); + return (exception != null + ? Tag.of("exception", exception.getClass().getSimpleName()) + : EXCEPTION_NONE); } }