From f355b174ad4efdcf40f2055ae97a8084ad1e4336 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 13 Oct 2020 01:00:35 +0200 Subject: [PATCH] Avoid creation of unused logger instance in AbstractMediaTypeExpression Closes gh-25901 --- .../condition/AbstractMediaTypeExpression.java | 13 +++---------- .../mvc/condition/AbstractMediaTypeExpression.java | 13 +++---------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/AbstractMediaTypeExpression.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/AbstractMediaTypeExpression.java index 2909f693ed8..63a9be42398 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/AbstractMediaTypeExpression.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/AbstractMediaTypeExpression.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,6 @@ package org.springframework.web.reactive.result.condition; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.springframework.http.MediaType; import org.springframework.lang.Nullable; import org.springframework.web.bind.annotation.RequestMapping; @@ -35,8 +32,6 @@ import org.springframework.web.server.UnsupportedMediaTypeStatusException; */ abstract class AbstractMediaTypeExpression implements Comparable, MediaTypeExpression { - protected final Log logger = LogFactory.getLog(getClass()); - private final MediaType mediaType; private final boolean isNegated; @@ -108,12 +103,10 @@ abstract class AbstractMediaTypeExpression implements Comparable { - protected final Log logger = LogFactory.getLog(getClass()); - private final MediaType mediaType; private final boolean isNegated; @@ -92,12 +87,10 @@ abstract class AbstractMediaTypeExpression implements MediaTypeExpression, Compa @Override public String toString() { - StringBuilder builder = new StringBuilder(); if (this.isNegated) { - builder.append('!'); + return '!' + this.mediaType.toString(); } - builder.append(this.mediaType.toString()); - return builder.toString(); + return this.mediaType.toString(); } }