Browse Source

Consistent final logger fields

pull/1197/head
Juergen Hoeller 9 years ago
parent
commit
cfa0f6c84b
  1. 4
      spring-aop/src/main/java/org/springframework/aop/target/dynamic/AbstractRefreshableTargetSource.java
  2. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerAdapter.java
  3. 2
      spring-web/src/main/java/org/springframework/http/server/reactive/ReactorHttpHandlerAdapter.java
  4. 2
      spring-web/src/main/java/org/springframework/http/server/reactive/RxNettyHttpHandlerAdapter.java
  5. 2
      spring-web/src/main/java/org/springframework/http/server/reactive/ServletHttpHandlerAdapter.java
  6. 2
      spring-web/src/main/java/org/springframework/http/server/reactive/UndertowHttpHandlerAdapter.java
  7. 2
      spring-web/src/main/java/org/springframework/web/server/adapter/HttpWebHandlerAdapter.java
  8. 24
      spring-web/src/main/java/org/springframework/web/server/handler/ExceptionHandlingWebHandler.java
  9. 2
      spring-websocket/src/main/java/org/springframework/web/socket/server/support/OriginHandshakeInterceptor.java
  10. 4
      spring-websocket/src/main/java/org/springframework/web/socket/sockjs/client/AbstractXhrTransport.java

4
spring-aop/src/main/java/org/springframework/aop/target/dynamic/AbstractRefreshableTargetSource.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -39,7 +39,7 @@ import org.springframework.aop.TargetSource;
public abstract class AbstractRefreshableTargetSource implements TargetSource, Refreshable { public abstract class AbstractRefreshableTargetSource implements TargetSource, Refreshable {
/** Logger available to subclasses */ /** Logger available to subclasses */
protected Log logger = LogFactory.getLog(getClass()); protected final Log logger = LogFactory.getLog(getClass());
protected Object targetObject; protected Object targetObject;

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerAdapter.java

@ -49,7 +49,6 @@ import org.springframework.web.reactive.result.method.HandlerMethodArgumentResol
import org.springframework.web.reactive.result.method.InvocableHandlerMethod; import org.springframework.web.reactive.result.method.InvocableHandlerMethod;
import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebExchange;
/** /**
* Supports the invocation of {@code @RequestMapping} methods. * Supports the invocation of {@code @RequestMapping} methods.
* *
@ -58,7 +57,7 @@ import org.springframework.web.server.ServerWebExchange;
*/ */
public class RequestMappingHandlerAdapter implements HandlerAdapter, BeanFactoryAware, InitializingBean { public class RequestMappingHandlerAdapter implements HandlerAdapter, BeanFactoryAware, InitializingBean {
private static Log logger = LogFactory.getLog(RequestMappingHandlerAdapter.class); private static final Log logger = LogFactory.getLog(RequestMappingHandlerAdapter.class);
private List<HandlerMethodArgumentResolver> customArgumentResolvers; private List<HandlerMethodArgumentResolver> customArgumentResolvers;

2
spring-web/src/main/java/org/springframework/http/server/reactive/ReactorHttpHandlerAdapter.java

@ -35,7 +35,7 @@ import org.springframework.util.Assert;
*/ */
public class ReactorHttpHandlerAdapter implements Function<HttpChannel, Mono<Void>> { public class ReactorHttpHandlerAdapter implements Function<HttpChannel, Mono<Void>> {
private static Log logger = LogFactory.getLog(ReactorHttpHandlerAdapter.class); private static final Log logger = LogFactory.getLog(ReactorHttpHandlerAdapter.class);
private final HttpHandler delegate; private final HttpHandler delegate;

2
spring-web/src/main/java/org/springframework/http/server/reactive/RxNettyHttpHandlerAdapter.java

@ -39,7 +39,7 @@ import org.springframework.util.Assert;
*/ */
public class RxNettyHttpHandlerAdapter implements RequestHandler<ByteBuf, ByteBuf> { public class RxNettyHttpHandlerAdapter implements RequestHandler<ByteBuf, ByteBuf> {
private static Log logger = LogFactory.getLog(RxNettyHttpHandlerAdapter.class); private static final Log logger = LogFactory.getLog(RxNettyHttpHandlerAdapter.class);
private final HttpHandler delegate; private final HttpHandler delegate;

2
spring-web/src/main/java/org/springframework/http/server/reactive/ServletHttpHandlerAdapter.java

@ -48,7 +48,7 @@ public class ServletHttpHandlerAdapter extends HttpServlet {
private static final int DEFAULT_BUFFER_SIZE = 8192; private static final int DEFAULT_BUFFER_SIZE = 8192;
private static Log logger = LogFactory.getLog(ServletHttpHandlerAdapter.class); private static final Log logger = LogFactory.getLog(ServletHttpHandlerAdapter.class);
private final HttpHandler handler; private final HttpHandler handler;

2
spring-web/src/main/java/org/springframework/http/server/reactive/UndertowHttpHandlerAdapter.java

@ -36,7 +36,7 @@ import org.springframework.util.Assert;
*/ */
public class UndertowHttpHandlerAdapter implements io.undertow.server.HttpHandler { public class UndertowHttpHandlerAdapter implements io.undertow.server.HttpHandler {
private static Log logger = LogFactory.getLog(UndertowHttpHandlerAdapter.class); private static final Log logger = LogFactory.getLog(UndertowHttpHandlerAdapter.class);
private final HttpHandler delegate; private final HttpHandler delegate;

2
spring-web/src/main/java/org/springframework/web/server/adapter/HttpWebHandlerAdapter.java

@ -42,7 +42,7 @@ import org.springframework.web.server.session.WebSessionManager;
*/ */
public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHandler { public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHandler {
private static Log logger = LogFactory.getLog(HttpWebHandlerAdapter.class); private static final Log logger = LogFactory.getLog(HttpWebHandlerAdapter.class);
private WebSessionManager sessionManager = new DefaultWebSessionManager(); private WebSessionManager sessionManager = new DefaultWebSessionManager();

24
spring-web/src/main/java/org/springframework/web/server/handler/ExceptionHandlingWebHandler.java

@ -41,8 +41,6 @@ import org.springframework.web.server.WebHandler;
*/ */
public class ExceptionHandlingWebHandler extends WebHandlerDecorator { public class ExceptionHandlingWebHandler extends WebHandlerDecorator {
private static Log logger = LogFactory.getLog(ExceptionHandlingWebHandler.class);
/** /**
* Log category to use on network IO exceptions after a client has gone away. * Log category to use on network IO exceptions after a client has gone away.
* <p>Servlet containers do not expose notifications when a client disconnects; * <p>Servlet containers do not expose notifications when a client disconnects;
@ -56,30 +54,29 @@ public class ExceptionHandlingWebHandler extends WebHandlerDecorator {
private static final String DISCONNECTED_CLIENT_LOG_CATEGORY = private static final String DISCONNECTED_CLIENT_LOG_CATEGORY =
ExceptionHandlingWebHandler.class.getName() + ".DisconnectedClient"; ExceptionHandlingWebHandler.class.getName() + ".DisconnectedClient";
private static final Log disconnectedClientLogger = LogFactory.getLog(DISCONNECTED_CLIENT_LOG_CATEGORY);
private static final Set<String> DISCONNECTED_CLIENT_EXCEPTIONS; private static final Set<String> DISCONNECTED_CLIENT_EXCEPTIONS;
static { static {
Set<String> set = new HashSet<>(3); Set<String> set = new HashSet<>(3);
set.add("ClientAbortException"); // Tomcat set.add("ClientAbortException"); // Tomcat
set.add("EOFException"); // Tomcat set.add("EOFException"); // Tomcat
set.add("EofException"); // Jetty set.add("EofException"); // Jetty
// java.io.IOException("Broken pipe") on WildFly (already covered) // java.io.IOException("Broken pipe") on WildFly (already covered)
DISCONNECTED_CLIENT_EXCEPTIONS = Collections.unmodifiableSet(set); DISCONNECTED_CLIENT_EXCEPTIONS = Collections.unmodifiableSet(set);
} }
private static final Log logger = LogFactory.getLog(ExceptionHandlingWebHandler.class);
private static final Log disconnectedClientLogger = LogFactory.getLog(DISCONNECTED_CLIENT_LOG_CATEGORY);
private final List<WebExceptionHandler> exceptionHandlers; private final List<WebExceptionHandler> exceptionHandlers;
public ExceptionHandlingWebHandler(WebHandler delegate, WebExceptionHandler... exceptionHandlers) { public ExceptionHandlingWebHandler(WebHandler delegate, WebExceptionHandler... exceptionHandlers) {
super(delegate); super(delegate);
this.exceptionHandlers = initList(exceptionHandlers); this.exceptionHandlers = (exceptionHandlers != null ?
} Collections.unmodifiableList(Arrays.asList(exceptionHandlers)): Collections.emptyList());
private static List<WebExceptionHandler> initList(WebExceptionHandler[] list) {
return (list != null ? Collections.unmodifiableList(Arrays.asList(list)):
Collections.emptyList());
} }
@ -115,6 +112,7 @@ public class ExceptionHandlingWebHandler extends WebHandlerDecorator {
private void logException(Throwable ex) { private void logException(Throwable ex) {
@SuppressWarnings("serial") @SuppressWarnings("serial")
NestedCheckedException nestedException = new NestedCheckedException("", ex) {}; NestedCheckedException nestedException = new NestedCheckedException("", ex) {};
if ("Broken pipe".equalsIgnoreCase(nestedException.getMostSpecificCause().getMessage()) || if ("Broken pipe".equalsIgnoreCase(nestedException.getMostSpecificCause().getMessage()) ||
DISCONNECTED_CLIENT_EXCEPTIONS.contains(ex.getClass().getSimpleName())) { DISCONNECTED_CLIENT_EXCEPTIONS.contains(ex.getClass().getSimpleName())) {

2
spring-websocket/src/main/java/org/springframework/web/socket/server/support/OriginHandshakeInterceptor.java

@ -42,7 +42,7 @@ import org.springframework.web.util.WebUtils;
*/ */
public class OriginHandshakeInterceptor implements HandshakeInterceptor { public class OriginHandshakeInterceptor implements HandshakeInterceptor {
protected Log logger = LogFactory.getLog(getClass()); protected final Log logger = LogFactory.getLog(getClass());
private final Set<String> allowedOrigins = new LinkedHashSet<>(); private final Set<String> allowedOrigins = new LinkedHashSet<>();

4
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/client/AbstractXhrTransport.java

@ -55,7 +55,7 @@ public abstract class AbstractXhrTransport implements XhrTransport {
} }
protected Log logger = LogFactory.getLog(getClass()); protected final Log logger = LogFactory.getLog(getClass());
private boolean xhrStreamingDisabled; private boolean xhrStreamingDisabled;
@ -71,11 +71,9 @@ public abstract class AbstractXhrTransport implements XhrTransport {
* An {@code XhrTransport} can support both the "xhr_streaming" and "xhr" * An {@code XhrTransport} can support both the "xhr_streaming" and "xhr"
* SockJS server transports. From a client perspective there is no * SockJS server transports. From a client perspective there is no
* implementation difference. * implementation difference.
*
* <p>Typically an {@code XhrTransport} is used as "XHR streaming" first and * <p>Typically an {@code XhrTransport} is used as "XHR streaming" first and
* then, if that fails, as "XHR". In some cases however it may be helpful to * then, if that fails, as "XHR". In some cases however it may be helpful to
* suppress XHR streaming so that only XHR is attempted. * suppress XHR streaming so that only XHR is attempted.
*
* <p>By default this property is set to {@code false} which means both * <p>By default this property is set to {@code false} which means both
* "XHR streaming" and "XHR" apply. * "XHR streaming" and "XHR" apply.
*/ */

Loading…
Cancel
Save