RequireThis rule and fixThis Gradle task
* `gradlew clean check -x test --parallel --continue` - to collect reports * `gradlew fixThis --parallel` - to fix all possible vulnerabilities. With `-Dfile.encoding=UTF-8` on Windows Since the `RequireThisCheck` doesn't see parents for anonymous classes (e.g. `Runnable` callback), its report doesn't contains the outer class name with `this.`, therefore we still have to fix those cases manually. Thanks to the wrong `replacer` just with `this.` we have uncompilable code enough easy to find problems. Not so easy to fix for good readability though... * Upgrade to Grade 2.12 * Upgrade to SonarQube native plugin The fix contains at about 300 files. So, will be done on merge. Fix `fixThis.gradle` according PR comments Apply `fixThis` and also `fixModifiers` for test classes. Fix some `this.` inner issues manually. Make code polishing for long lines after `fixThis` Fix conflicts and vulnerabilities after the rebase
This commit is contained in:
@@ -47,7 +47,7 @@ public class CrossOrigin {
|
||||
}
|
||||
|
||||
public String[] getOrigin() {
|
||||
return origin;
|
||||
return this.origin;
|
||||
}
|
||||
|
||||
public void setAllowedHeaders(String... allowedHeaders) {
|
||||
@@ -55,7 +55,7 @@ public class CrossOrigin {
|
||||
}
|
||||
|
||||
public String[] getAllowedHeaders() {
|
||||
return allowedHeaders;
|
||||
return this.allowedHeaders;
|
||||
}
|
||||
|
||||
public void setExposedHeaders(String... exposedHeaders) {
|
||||
@@ -63,7 +63,7 @@ public class CrossOrigin {
|
||||
}
|
||||
|
||||
public String[] getExposedHeaders() {
|
||||
return exposedHeaders;
|
||||
return this.exposedHeaders;
|
||||
}
|
||||
|
||||
public void setMethod(RequestMethod... method) {
|
||||
@@ -71,7 +71,7 @@ public class CrossOrigin {
|
||||
}
|
||||
|
||||
public RequestMethod[] getMethod() {
|
||||
return method;
|
||||
return this.method;
|
||||
}
|
||||
|
||||
public void setAllowCredentials(Boolean allowCredentials) {
|
||||
@@ -79,7 +79,7 @@ public class CrossOrigin {
|
||||
}
|
||||
|
||||
public Boolean getAllowCredentials() {
|
||||
return allowCredentials;
|
||||
return this.allowCredentials;
|
||||
}
|
||||
|
||||
public void setMaxAge(long maxAge) {
|
||||
@@ -87,7 +87,7 @@ public class CrossOrigin {
|
||||
}
|
||||
|
||||
public long getMaxAge() {
|
||||
return maxAge;
|
||||
return this.maxAge;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -182,10 +182,10 @@ public class HttpRequestHandlingController extends HttpRequestHandlingEndpointSu
|
||||
MapBindingResult errors = new MapBindingResult(new HashMap<String, Object>(), "dummy");
|
||||
PrintWriter stackTrace = new PrintWriter(new StringWriter());
|
||||
e.printStackTrace(stackTrace);
|
||||
errors.reject(errorCode, new Object[] { e, e.getMessage(), stackTrace.toString() },
|
||||
errors.reject(this.errorCode, new Object[] { e, e.getMessage(), stackTrace.toString() },
|
||||
"A Spring Integration handler raised an exception while handling an HTTP request. The exception is of type "
|
||||
+ e.getClass() + " and it has a message: (" + e.getMessage() + ")");
|
||||
modelAndView.addObject(errorsKey, errors);
|
||||
modelAndView.addObject(this.errorsKey, errors);
|
||||
}
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ public abstract class HttpRequestHandlingEndpointSupport extends MessagingGatewa
|
||||
* @return Whether to expect a reply.
|
||||
*/
|
||||
protected boolean isExpectReply() {
|
||||
return expectReply;
|
||||
return this.expectReply;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -283,7 +283,7 @@ public abstract class HttpRequestHandlingEndpointSupport extends MessagingGatewa
|
||||
}
|
||||
|
||||
public final RequestMapping getRequestMapping() {
|
||||
return requestMapping;
|
||||
return this.requestMapping;
|
||||
}
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@ public abstract class HttpRequestHandlingEndpointSupport extends MessagingGatewa
|
||||
}
|
||||
|
||||
public CrossOrigin getCrossOrigin() {
|
||||
return crossOrigin;
|
||||
return this.crossOrigin;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2015 the original author or authors.
|
||||
* Copyright 2013-2016 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.
|
||||
@@ -51,7 +51,7 @@ public class RequestMapping {
|
||||
}
|
||||
|
||||
public String[] getPathPatterns() {
|
||||
return pathPatterns;
|
||||
return this.pathPatterns;
|
||||
}
|
||||
|
||||
public void setMethods(HttpMethod... supportedMethods) {
|
||||
@@ -60,7 +60,7 @@ public class RequestMapping {
|
||||
}
|
||||
|
||||
public HttpMethod[] getMethods() {
|
||||
return methods;
|
||||
return this.methods;
|
||||
}
|
||||
|
||||
public void setParams(String... params) {
|
||||
@@ -69,7 +69,7 @@ public class RequestMapping {
|
||||
}
|
||||
|
||||
public String[] getParams() {
|
||||
return params;
|
||||
return this.params;
|
||||
}
|
||||
|
||||
public void setHeaders(String... headers) {
|
||||
@@ -78,7 +78,7 @@ public class RequestMapping {
|
||||
}
|
||||
|
||||
public String[] getHeaders() {
|
||||
return headers;
|
||||
return this.headers;
|
||||
}
|
||||
|
||||
public void setConsumes(String... consumes) {
|
||||
@@ -87,7 +87,7 @@ public class RequestMapping {
|
||||
}
|
||||
|
||||
public String[] getConsumes() {
|
||||
return consumes;
|
||||
return this.consumes;
|
||||
}
|
||||
|
||||
public void setProduces(String... produces) {
|
||||
@@ -96,7 +96,7 @@ public class RequestMapping {
|
||||
}
|
||||
|
||||
public String[] getProduces() {
|
||||
return produces;
|
||||
return this.produces;
|
||||
}
|
||||
|
||||
public RequestMethod[] getRequestMethods() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -53,7 +53,7 @@ public class SimpleMultipartFileReader implements MultipartFileReader<Object> {
|
||||
MediaType contentType = MediaType.parseMediaType(multipartFile.getContentType());
|
||||
Charset charset = contentType.getCharSet();
|
||||
if (charset == null) {
|
||||
charset = defaultCharset;
|
||||
charset = this.defaultCharset;
|
||||
}
|
||||
return new String(multipartFile.getBytes(), charset.name());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -400,7 +400,7 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
|
||||
public void fromHeaders(MessageHeaders headers, HttpHeaders target) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(MessageFormat.format("outboundHeaderNames={0}",
|
||||
CollectionUtils.arrayToList(outboundHeaderNames)));
|
||||
CollectionUtils.arrayToList(this.outboundHeaderNames)));
|
||||
}
|
||||
for (Entry<String, Object> entry : headers.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
@@ -434,7 +434,7 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
|
||||
public Map<String, Object> toHeaders(HttpHeaders source) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(MessageFormat.format("inboundHeaderNames={0}",
|
||||
CollectionUtils.arrayToList(inboundHeaderNames)));
|
||||
CollectionUtils.arrayToList(this.inboundHeaderNames)));
|
||||
}
|
||||
Map<String, Object> target = new HashMap<String, Object>();
|
||||
Set<String> headerNames = source.keySet();
|
||||
|
||||
@@ -427,7 +427,7 @@ public class HttpRequestHandlingMessagingGatewayTests extends AbstractHttpInboun
|
||||
|
||||
private static class TestHttpMessageConverter extends AbstractHttpMessageConverter<Exception> {
|
||||
|
||||
public TestHttpMessageConverter() {
|
||||
TestHttpMessageConverter() {
|
||||
setSupportedMediaTypes(Arrays.asList(MediaType.ALL));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user