Always use 'this.' when accessing fields

Ensure that `this.` is used consistently when accessing class
fields.

Issue: SPR-16968
This commit is contained in:
Phillip Webb
2018-06-25 11:37:17 -07:00
committed by Juergen Hoeller
parent eeebd51f57
commit 0b53c1096a
154 changed files with 374 additions and 373 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -116,16 +116,16 @@ public class WebSocketConnectionManager extends ConnectionManagerSupport {
@Override
public void startInternal() {
if (this.client instanceof Lifecycle && !((Lifecycle) client).isRunning()) {
((Lifecycle) client).start();
if (this.client instanceof Lifecycle && !((Lifecycle) this.client).isRunning()) {
((Lifecycle) this.client).start();
}
super.startInternal();
}
@Override
public void stopInternal() throws Exception {
if (this.client instanceof Lifecycle && ((Lifecycle) client).isRunning()) {
((Lifecycle) client).stop();
if (this.client instanceof Lifecycle && ((Lifecycle) this.client).isRunning()) {
((Lifecycle) this.client).stop();
}
super.stopInternal();
}

View File

@@ -154,7 +154,7 @@ public class JettyWebSocketClient extends AbstractWebSocketClient implements Lif
final JettyWebSocketHandlerAdapter listener = new JettyWebSocketHandlerAdapter(wsHandler, wsSession);
Callable<WebSocketSession> connectTask = () -> {
Future<Session> future = client.connect(listener, uri, request);
Future<Session> future = this.client.connect(listener, uri, request);
future.get();
return wsSession;
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -108,12 +108,12 @@ public class AnnotatedEndpointConnectionManager extends ConnectionManagerSupport
if (logger.isInfoEnabled()) {
logger.info("Connecting to WebSocket at " + getUri());
}
Object endpointToUse = endpoint;
Object endpointToUse = this.endpoint;
if (endpointToUse == null) {
Assert.state(endpointProvider != null, "No endpoint set");
endpointToUse = endpointProvider.getHandler();
Assert.state(this.endpointProvider != null, "No endpoint set");
endpointToUse = this.endpointProvider.getHandler();
}
session = webSocketContainer.connectToServer(endpointToUse, getUri());
this.session = this.webSocketContainer.connectToServer(endpointToUse, getUri());
logger.info("Successfully connected to WebSocket");
}
catch (Throwable ex) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -139,13 +139,13 @@ public class EndpointConnectionManager extends ConnectionManagerSupport implemen
if (logger.isInfoEnabled()) {
logger.info("Connecting to WebSocket at " + getUri());
}
Endpoint endpointToUse = endpoint;
Endpoint endpointToUse = this.endpoint;
if (endpointToUse == null) {
Assert.state(endpointProvider != null, "No endpoint set");
endpointToUse = endpointProvider.getHandler();
Assert.state(this.endpointProvider != null, "No endpoint set");
endpointToUse = this.endpointProvider.getHandler();
}
ClientEndpointConfig endpointConfig = configBuilder.build();
session = getWebSocketContainer().connectToServer(endpointToUse, endpointConfig, getUri());
ClientEndpointConfig endpointConfig = this.configBuilder.build();
this.session = getWebSocketContainer().connectToServer(endpointToUse, endpointConfig, getUri());
logger.info("Successfully connected to WebSocket");
}
catch (Throwable ex) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -147,7 +147,7 @@ public class StandardWebSocketClient extends AbstractWebSocketClient {
final Endpoint endpoint = new StandardWebSocketHandlerAdapter(webSocketHandler, session);
Callable<WebSocketSession> connectTask = () -> {
webSocketContainer.connectToServer(endpoint, endpointConfig, uri);
this.webSocketContainer.connectToServer(endpoint, endpointConfig, uri);
return session;
};

View File

@@ -156,7 +156,7 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat
}
finally {
this.sendStartTime = 0;
flushLock.unlock();
this.flushLock.unlock();
}
return true;
}

View File

@@ -404,7 +404,7 @@ public class WebSocketStompClient extends StompClientSupport implements SmartLif
Assert.state(getTaskScheduler() != null, "No TaskScheduler configured");
this.lastReadTime = System.currentTimeMillis();
this.inactivityTasks.add(getTaskScheduler().scheduleWithFixedDelay(() -> {
if (System.currentTimeMillis() - lastReadTime > duration) {
if (System.currentTimeMillis() - this.lastReadTime > duration) {
try {
runnable.run();
}
@@ -422,7 +422,7 @@ public class WebSocketStompClient extends StompClientSupport implements SmartLif
Assert.state(getTaskScheduler() != null, "No TaskScheduler configured");
this.lastWriteTime = System.currentTimeMillis();
this.inactivityTasks.add(getTaskScheduler().scheduleWithFixedDelay(() -> {
if (System.currentTimeMillis() - lastWriteTime > duration) {
if (System.currentTimeMillis() - this.lastWriteTime > duration) {
try {
runnable.run();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -115,7 +115,7 @@ public class JettyRequestUpgradeStrategy implements RequestUpgradeStrategy, Serv
this.running = true;
try {
if (this.factory == null) {
this.factory = new WebSocketServerFactory(servletContext, this.policy);
this.factory = new WebSocketServerFactory(this.servletContext, this.policy);
}
this.factory.setCreator((request, response) -> {
WebSocketHandlerContainer container = containerHolder.get();

View File

@@ -177,16 +177,16 @@ public class WebLogicRequestUpgradeStrategy extends AbstractTyrusRequestUpgradeS
public SubjectHelper() {
try {
String className = "weblogic.servlet.internal.WebAppServletContext";
securityContextMethod = method(className, "getSecurityContext");
this.securityContextMethod = method(className, "getSecurityContext");
className = "weblogic.servlet.security.internal.SecurityModule";
currentUserMethod = method(className, "getCurrentUser",
this.currentUserMethod = method(className, "getCurrentUser",
type("weblogic.servlet.security.internal.ServletSecurityContext"),
HttpServletRequest.class);
className = "weblogic.servlet.security.internal.WebAppSecurity";
providerMethod = method(className, "getProvider");
anonymousSubjectMethod = providerMethod.getReturnType().getDeclaredMethod("getAnonymousSubject");
this.providerMethod = method(className, "getProvider");
this.anonymousSubjectMethod = this.providerMethod.getReturnType().getDeclaredMethod("getAnonymousSubject");
}
catch (Exception ex) {
throw new IllegalStateException("No compatible WebSocket version found", ex);
@@ -196,11 +196,11 @@ public class WebLogicRequestUpgradeStrategy extends AbstractTyrusRequestUpgradeS
public Object getSubject(HttpServletRequest request) {
try {
ServletContext servletContext = request.getServletContext();
Object securityContext = securityContextMethod.invoke(servletContext);
Object subject = currentUserMethod.invoke(null, securityContext, request);
Object securityContext = this.securityContextMethod.invoke(servletContext);
Object subject = this.currentUserMethod.invoke(null, securityContext, request);
if (subject == null) {
Object securityProvider = providerMethod.invoke(null);
subject = anonymousSubjectMethod.invoke(securityProvider);
Object securityProvider = this.providerMethod.invoke(null);
subject = this.anonymousSubjectMethod.invoke(securityProvider);
}
return subject;
}

View File

@@ -271,7 +271,7 @@ public class JettyXhrTransport extends AbstractXhrTransport implements Lifecycle
@Override
public void onFailure(Response response, Throwable failure) {
if (connectFuture.setException(failure)) {
if (this.connectFuture.setException(failure)) {
return;
}
if (this.sockJsSession.isDisconnected()) {

View File

@@ -367,10 +367,10 @@ public class TransportHandlingSockJsService extends AbstractSockJsService implem
}
this.sessionCleanupTask = getTaskScheduler().scheduleAtFixedRate(() -> {
List<String> removedIds = new ArrayList<>();
for (SockJsSession session : sessions.values()) {
for (SockJsSession session : this.sessions.values()) {
try {
if (session.getTimeSinceLastActive() > getDisconnectDelay()) {
sessions.remove(session.getId());
this.sessions.remove(session.getId());
removedIds.add(session.getId());
session.close();
}