Commit 2b98b11c authored by Stephane Nicoll's avatar Stephane Nicoll

Polish "Less object instantiation in WebMvcTags"

Closes gh-12894
parent d6761476
...@@ -58,7 +58,7 @@ public final class WebMvcTags { ...@@ -58,7 +58,7 @@ public final class WebMvcTags {
* @return the method tag whose value is a capitalized method (e.g. GET). * @return the method tag whose value is a capitalized method (e.g. GET).
*/ */
public static Tag method(HttpServletRequest request) { 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 { ...@@ -67,8 +67,8 @@ public final class WebMvcTags {
* @return the status tag derived from the status of the response * @return the status tag derived from the status of the response
*/ */
public static Tag status(HttpServletResponse response) { public static Tag status(HttpServletResponse response) {
return response == null ? STATUS_UNKNOWN : return (response == null ? STATUS_UNKNOWN :
Tag.of("status", Integer.toString(response.getStatus())); Tag.of("status", Integer.toString(response.getStatus())));
} }
/** /**
...@@ -128,8 +128,9 @@ public final class WebMvcTags { ...@@ -128,8 +128,9 @@ public final class WebMvcTags {
* @return the exception tag derived from the exception * @return the exception tag derived from the exception
*/ */
public static Tag exception(Throwable exception) { public static Tag exception(Throwable exception) {
return exception == null ? EXCEPTION_NONE : return (exception != null
Tag.of("exception", exception.getClass().getSimpleName()); ? Tag.of("exception", exception.getClass().getSimpleName())
: EXCEPTION_NONE);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment