Always use 'this.' when accessing fields

Apply an Eclipse cleanup rules to ensure that fields are always accessed
using `this.`. This aligns with the style used by Spring Framework and
helps users quickly see the difference between a local and member
variable.

Issue gh-8945
This commit is contained in:
Phillip Webb
2020-07-26 11:51:05 -07:00
committed by Rob Winch
parent 6894ff5d12
commit 8866fa6fb0
793 changed files with 8689 additions and 8459 deletions

View File

@@ -47,11 +47,11 @@ public class MockOpenIDConsumer implements OpenIDConsumer {
}
public String beginConsumption(HttpServletRequest req, String claimedIdentity, String returnToUrl, String realm) {
return redirectUrl;
return this.redirectUrl;
}
public OpenIDAuthenticationToken endConsumption(HttpServletRequest req) {
return token;
return this.token;
}
/**

View File

@@ -70,7 +70,7 @@ public class OpenID4JavaConsumerTests {
consumer.beginConsumption(request, "", "", "");
assertThat(request.getSession().getAttribute("SPRING_SECURITY_OPEN_ID_ATTRIBUTES_FETCH_LIST"))
.isEqualTo(attributes);
.isEqualTo(this.attributes);
assertThat(request.getSession().getAttribute(DiscoveryInformation.class.getName())).isEqualTo(di);
// Check with empty attribute fetch list
@@ -180,7 +180,7 @@ public class OpenID4JavaConsumerTests {
MockHttpServletRequest request = new MockHttpServletRequest();
request.getSession().setAttribute(DiscoveryInformation.class.getName(), di);
request.getSession().setAttribute("SPRING_SECURITY_OPEN_ID_ATTRIBUTES_FETCH_LIST", attributes);
request.getSession().setAttribute("SPRING_SECURITY_OPEN_ID_ATTRIBUTES_FETCH_LIST", this.attributes);
OpenIDAuthenticationToken auth = consumer.endConsumption(request);
@@ -196,7 +196,7 @@ public class OpenID4JavaConsumerTests {
when(msg.getExtension(AxMessage.OPENID_NS_AX)).thenReturn(fr);
when(fr.getAttributeValues("a")).thenReturn(Arrays.asList("x", "y"));
List<OpenIDAttribute> fetched = consumer.fetchAxAttributes(msg, attributes);
List<OpenIDAttribute> fetched = consumer.fetchAxAttributes(msg, this.attributes);
assertThat(fetched).hasSize(1);
assertThat(fetched.get(0).getValues()).hasSize(2);
@@ -211,7 +211,7 @@ public class OpenID4JavaConsumerTests {
when(msg.getExtension(AxMessage.OPENID_NS_AX)).thenThrow(new MessageException(""));
when(fr.getAttributeValues("a")).thenReturn(Arrays.asList("x", "y"));
consumer.fetchAxAttributes(msg, attributes);
consumer.fetchAxAttributes(msg, this.attributes);
}
@Test(expected = OpenIDConsumerException.class)
@@ -229,7 +229,7 @@ public class OpenID4JavaConsumerTests {
private class MockAttributesFactory implements AxFetchListFactory {
public List<OpenIDAttribute> createAttributeList(String identifier) {
return attributes;
return OpenID4JavaConsumerTests.this.attributes;
}
}

View File

@@ -57,13 +57,13 @@ public class OpenIDAuthenticationFilterTests {
@Before
public void setUp() {
filter = new OpenIDAuthenticationFilter();
filter.setConsumer(new MockOpenIDConsumer(REDIRECT_URL));
this.filter = new OpenIDAuthenticationFilter();
this.filter.setConsumer(new MockOpenIDConsumer(REDIRECT_URL));
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
filter.setAuthenticationSuccessHandler(new SavedRequestAwareAuthenticationSuccessHandler());
this.filter.setAuthenticationSuccessHandler(new SavedRequestAwareAuthenticationSuccessHandler());
successHandler.setDefaultTargetUrl(DEFAULT_TARGET_URL);
filter.setAuthenticationManager(a -> a);
filter.afterPropertiesSet();
this.filter.setAuthenticationManager(a -> a);
this.filter.afterPropertiesSet();
}
@Test
@@ -77,7 +77,7 @@ public class OpenIDAuthenticationFilterTests {
req.setParameter("openid_identifier", " " + CLAIMED_IDENTITY_URL);
req.setRemoteHost("www.example.com");
filter.setConsumer(new MockOpenIDConsumer() {
this.filter.setConsumer(new MockOpenIDConsumer() {
public String beginConsumption(HttpServletRequest req, String claimedIdentity, String returnToUrl,
String realm) {
assertThat(claimedIdentity).isEqualTo(CLAIMED_IDENTITY_URL);
@@ -88,7 +88,7 @@ public class OpenIDAuthenticationFilterTests {
});
FilterChain fc = mock(FilterChain.class);
filter.doFilter(req, response, fc);
this.filter.doFilter(req, response, fc);
assertThat(response.getRedirectedUrl()).isEqualTo(REDIRECT_URL);
// Filter chain shouldn't proceed
verify(fc, never()).doFilter(any(HttpServletRequest.class), any(HttpServletResponse.class));
@@ -104,9 +104,9 @@ public class OpenIDAuthenticationFilterTests {
String paramValue = "https://example.com/path?a=b&c=d";
MockHttpServletRequest req = new MockHttpServletRequest("GET", REQUEST_PATH);
req.addParameter(paramName, paramValue);
filter.setReturnToUrlParameters(Collections.singleton(paramName));
this.filter.setReturnToUrlParameters(Collections.singleton(paramName));
URI returnTo = new URI(filter.buildReturnToUrl(req));
URI returnTo = new URI(this.filter.buildReturnToUrl(req));
String query = returnTo.getRawQuery();
assertThat(count(query, '=')).isEqualTo(1);
assertThat(count(query, '&')).isZero();