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

@@ -52,7 +52,7 @@ public class ModelAndViewDefiningException extends ServletException {
* Return the ModelAndView that this exception contains for forwarding to.
*/
public ModelAndView getModelAndView() {
return modelAndView;
return this.modelAndView;
}
}

View File

@@ -178,7 +178,7 @@ public class ResourceHandlerRegistry {
}
SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping();
handlerMapping.setOrder(order);
handlerMapping.setOrder(this.order);
handlerMapping.setUrlMap(urlMap);
return handlerMapping;
}

View File

@@ -152,7 +152,7 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
* Return the UrlPathHelper implementation to use for resolution of lookup paths.
*/
public UrlPathHelper getUrlPathHelper() {
return urlPathHelper;
return this.urlPathHelper;
}
/**

View File

@@ -133,7 +133,7 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
* Keys are view names; values are status codes.
*/
public Map<String, Integer> getStatusCodesAsMap() {
return Collections.unmodifiableMap(statusCodes);
return Collections.unmodifiableMap(this.statusCodes);
}
/**

View File

@@ -113,7 +113,7 @@ public final class HeadersRequestCondition extends AbstractRequestCondition<Head
if (CorsUtils.isPreFlightRequest(request)) {
return PRE_FLIGHT_MATCH;
}
for (HeaderExpression expression : expressions) {
for (HeaderExpression expression : this.expressions) {
if (!expression.match(request)) {
return null;
}

View File

@@ -98,7 +98,7 @@ public final class ParamsRequestCondition extends AbstractRequestCondition<Param
@Override
@Nullable
public ParamsRequestCondition getMatchingCondition(HttpServletRequest request) {
for (ParamExpression expression : expressions) {
for (ParamExpression expression : this.expressions) {
if (!expression.match(request)) {
return null;
}

View File

@@ -825,7 +825,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
synchronized (this.sessionAttributesHandlerCache) {
sessionAttrHandler = this.sessionAttributesHandlerCache.get(handlerType);
if (sessionAttrHandler == null) {
sessionAttrHandler = new SessionAttributesHandler(handlerType, sessionAttributeStore);
sessionAttrHandler = new SessionAttributesHandler(handlerType, this.sessionAttributeStore);
this.sessionAttributesHandlerCache.put(handlerType, sessionAttrHandler);
}
}

View File

@@ -300,12 +300,12 @@ public class VersionResourceResolver extends AbstractResourceResolver {
@Override
public String getDescription() {
return original.getDescription();
return this.original.getDescription();
}
@Override
public InputStream getInputStream() throws IOException {
return original.getInputStream();
return this.original.getInputStream();
}
@Override

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.
@@ -105,7 +105,7 @@ public class WebJarsResourceResolver extends AbstractResourceResolver {
if (endOffset != -1) {
String webjar = path.substring(startOffset, endOffset);
String partialPath = path.substring(endOffset + 1);
String webJarPath = webJarAssetLocator.getFullPathExact(webjar, partialPath);
String webJarPath = this.webJarAssetLocator.getFullPathExact(webjar, partialPath);
if (webJarPath != null) {
return webJarPath.substring(WEBJARS_LOCATION_LENGTH);
}

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.
@@ -146,7 +146,7 @@ public class BindTag extends HtmlEscapingAwareTag implements EditorAwareTag {
protected final int doStartTagInternal() throws Exception {
String resolvedPath = getPath();
if (!isIgnoreNestedPath()) {
String nestedPath = (String) pageContext.getAttribute(
String nestedPath = (String) this.pageContext.getAttribute(
NestedPathTag.NESTED_PATH_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
// only prepend if not already an absolute path
if (nestedPath != null && !resolvedPath.startsWith(nestedPath) &&
@@ -163,13 +163,13 @@ public class BindTag extends HtmlEscapingAwareTag implements EditorAwareTag {
}
// Save previous status values, for re-exposure at the end of this tag.
this.previousPageStatus = pageContext.getAttribute(STATUS_VARIABLE_NAME, PageContext.PAGE_SCOPE);
this.previousRequestStatus = pageContext.getAttribute(STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
this.previousPageStatus = this.pageContext.getAttribute(STATUS_VARIABLE_NAME, PageContext.PAGE_SCOPE);
this.previousRequestStatus = this.pageContext.getAttribute(STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
// Expose this tag's status object as PageContext attribute,
// making it available for JSP EL.
pageContext.removeAttribute(STATUS_VARIABLE_NAME, PageContext.PAGE_SCOPE);
pageContext.setAttribute(STATUS_VARIABLE_NAME, this.status, PageContext.REQUEST_SCOPE);
this.pageContext.removeAttribute(STATUS_VARIABLE_NAME, PageContext.PAGE_SCOPE);
this.pageContext.setAttribute(STATUS_VARIABLE_NAME, this.status, PageContext.REQUEST_SCOPE);
return EVAL_BODY_INCLUDE;
}
@@ -178,13 +178,13 @@ public class BindTag extends HtmlEscapingAwareTag implements EditorAwareTag {
public int doEndTag() {
// Reset previous status values.
if (this.previousPageStatus != null) {
pageContext.setAttribute(STATUS_VARIABLE_NAME, this.previousPageStatus, PageContext.PAGE_SCOPE);
this.pageContext.setAttribute(STATUS_VARIABLE_NAME, this.previousPageStatus, PageContext.PAGE_SCOPE);
}
if (this.previousRequestStatus != null) {
pageContext.setAttribute(STATUS_VARIABLE_NAME, this.previousRequestStatus, PageContext.REQUEST_SCOPE);
this.pageContext.setAttribute(STATUS_VARIABLE_NAME, this.previousRequestStatus, PageContext.REQUEST_SCOPE);
}
else {
pageContext.removeAttribute(STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
this.pageContext.removeAttribute(STATUS_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
}
return EVAL_PAGE;
}

View File

@@ -278,7 +278,7 @@ public class MessageTag extends HtmlEscapingAwareTag implements ArgumentAware {
// Expose as variable, if demanded, else write to the page.
if (this.var != null) {
pageContext.setAttribute(this.var, msg, TagUtils.getScope(this.scope));
this.pageContext.setAttribute(this.var, msg, TagUtils.getScope(this.scope));
}
else {
writeMessage(msg);
@@ -394,7 +394,7 @@ public class MessageTag extends HtmlEscapingAwareTag implements ArgumentAware {
* @throws IOException if writing failed
*/
protected void writeMessage(String msg) throws IOException {
pageContext.getOut().write(String.valueOf(msg));
this.pageContext.getOut().write(String.valueOf(msg));
}
/**

View File

@@ -106,10 +106,10 @@ public class NestedPathTag extends TagSupport implements TryCatchFinally {
// Save previous nestedPath value, build and expose current nestedPath value.
// Use request scope to expose nestedPath to included pages too.
this.previousNestedPath =
(String) pageContext.getAttribute(NESTED_PATH_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
(String) this.pageContext.getAttribute(NESTED_PATH_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
String nestedPath =
(this.previousNestedPath != null ? this.previousNestedPath + getPath() : getPath());
pageContext.setAttribute(NESTED_PATH_VARIABLE_NAME, nestedPath, PageContext.REQUEST_SCOPE);
this.pageContext.setAttribute(NESTED_PATH_VARIABLE_NAME, nestedPath, PageContext.REQUEST_SCOPE);
return EVAL_BODY_INCLUDE;
}
@@ -121,11 +121,11 @@ public class NestedPathTag extends TagSupport implements TryCatchFinally {
public int doEndTag() {
if (this.previousNestedPath != null) {
// Expose previous nestedPath value.
pageContext.setAttribute(NESTED_PATH_VARIABLE_NAME, this.previousNestedPath, PageContext.REQUEST_SCOPE);
this.pageContext.setAttribute(NESTED_PATH_VARIABLE_NAME, this.previousNestedPath, PageContext.REQUEST_SCOPE);
}
else {
// Remove exposed nestedPath value.
pageContext.removeAttribute(NESTED_PATH_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
this.pageContext.removeAttribute(NESTED_PATH_VARIABLE_NAME, PageContext.REQUEST_SCOPE);
}
return EVAL_PAGE;

View File

@@ -154,12 +154,12 @@ public class TransformTag extends HtmlEscapingAwareTag {
}
result = htmlEscape(result);
if (this.var != null) {
pageContext.setAttribute(this.var, result, TagUtils.getScope(this.scope));
this.pageContext.setAttribute(this.var, result, TagUtils.getScope(this.scope));
}
else {
try {
// Else, just print it out.
pageContext.getOut().print(result);
this.pageContext.getOut().print(result);
}
catch (IOException ex) {
throw new JspException(ex);

View File

@@ -245,7 +245,7 @@ public class UrlTag extends HtmlEscapingAwareTag implements ParamAware {
if (this.var == null) {
// print the url to the writer
try {
pageContext.getOut().print(url);
this.pageContext.getOut().print(url);
}
catch (IOException ex) {
throw new JspException(ex);
@@ -253,7 +253,7 @@ public class UrlTag extends HtmlEscapingAwareTag implements ParamAware {
}
else {
// store the url as a variable
pageContext.setAttribute(var, url, scope);
this.pageContext.setAttribute(this.var, url, this.scope);
}
return EVAL_PAGE;
}
@@ -265,8 +265,8 @@ public class UrlTag extends HtmlEscapingAwareTag implements ParamAware {
*/
String createUrl() throws JspException {
Assert.state(this.value != null, "No value set");
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
HttpServletResponse response = (HttpServletResponse) this.pageContext.getResponse();
StringBuilder url = new StringBuilder();
if (this.type == UrlType.CONTEXT_RELATIVE) {
@@ -317,7 +317,7 @@ public class UrlTag extends HtmlEscapingAwareTag implements ParamAware {
protected String createQueryString(List<Param> params, Set<String> usedParams, boolean includeQueryStringDelimiter)
throws JspException {
String encoding = pageContext.getResponse().getCharacterEncoding();
String encoding = this.pageContext.getResponse().getCharacterEncoding();
StringBuilder qs = new StringBuilder();
for (Param param : params) {
if (!usedParams.contains(param.getName()) && StringUtils.hasLength(param.getName())) {
@@ -354,7 +354,7 @@ public class UrlTag extends HtmlEscapingAwareTag implements ParamAware {
protected String replaceUriTemplateParams(String uri, List<Param> params, Set<String> usedParams)
throws JspException {
String encoding = pageContext.getResponse().getCharacterEncoding();
String encoding = this.pageContext.getResponse().getCharacterEncoding();
for (Param param : params) {
String template = URL_TEMPLATE_DELIMITER_PREFIX + param.getName() + URL_TEMPLATE_DELIMITER_SUFFIX;
if (uri.contains(template)) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 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.
@@ -403,7 +403,7 @@ public abstract class AbstractHtmlElementTag extends AbstractDataBoundFormElemen
throw new IllegalArgumentException(
"Attribute " + localName + "=\"" + value + "\" is not allowed");
}
dynamicAttributes.put(localName, value);
this.dynamicAttributes.put(localName, value);
}
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 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.
@@ -489,7 +489,7 @@ public class SelectTag extends AbstractHtmlInputElementTag {
public int doEndTag() throws JspException {
if (this.tagWriter != null) {
this.tagWriter.endTag();
writeHiddenTagIfNecessary(tagWriter);
writeHiddenTagIfNecessary(this.tagWriter);
}
return EVAL_PAGE;
}

View File

@@ -81,7 +81,7 @@ public class CookieThemeResolver extends CookieGenerator implements ThemeResolve
* Return the name of the default theme.
*/
public String getDefaultThemeName() {
return defaultThemeName;
return this.defaultThemeName;
}

View File

@@ -266,7 +266,7 @@ public class ScriptTemplateView extends AbstractUrlBasedView {
new EngineKey(this.engineName, this.scripts) : this.engineName);
ScriptEngine engine = engines.get(engineKey);
if (engine == null) {
engine = createEngineFromName(engineName);
engine = createEngineFromName(this.engineName);
engines.put(engineKey, engine);
}
return engine;