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:
Artem Bilan
2016-03-17 17:02:15 -04:00
parent e189307ab6
commit 2b0598291c
348 changed files with 1828 additions and 1781 deletions

View File

@@ -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.
@@ -44,7 +44,7 @@ public class AggregatedXmlMessageValidationException extends RuntimeException {
}
public List<Throwable> getExceptions() {
return Collections.unmodifiableList(exceptions);
return Collections.unmodifiableList(this.exceptions);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 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.
@@ -78,7 +78,7 @@ public class XPathFilterParser extends AbstractConsumerEndpointParser {
Assert.isTrue(xPathExpressionChildPresent ^ xPathReferencePresent,
"Exactly one of 'xpath-expression' or 'xpath-expression-ref' is required.");
if (xPathExpressionChildPresent) {
BeanDefinition beanDefinition = xpathParser.parse((Element) xPathExpressionNodes.item(0), parserContext);
BeanDefinition beanDefinition = this.xpathParser.parse((Element) xPathExpressionNodes.item(0), parserContext);
selectorBuilder.addConstructorArgValue(beanDefinition);
}
else {

View File

@@ -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.
@@ -85,7 +85,7 @@ public abstract class AbstractXPathMessageSelector implements MessageSelector {
}
protected XPathExpression getXPathExpresion() {
return xPathExpresion;
return this.xPathExpresion;
}
}

View File

@@ -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.
@@ -133,8 +133,8 @@ public class XmlValidatingMessageSelector implements MessageSelector {
new AggregatedXmlMessageValidationException(
Arrays.<Throwable>asList(validationExceptions)));
}
if (logger.isDebugEnabled()) {
logger.debug("Message was rejected due to XML Validation errors");
if (this.logger.isDebugEnabled()) {
this.logger.debug("Message was rejected due to XML Validation errors");
}
}
return validationSuccess;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 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.
@@ -97,7 +97,7 @@ public class DomSourceFactory implements SourceFactory {
private DocumentBuilder getNewDocumentBuilder() throws ParserConfigurationException {
synchronized (this.documentBuilderFactory) {
return documentBuilderFactory.newDocumentBuilder();
return this.documentBuilderFactory.newDocumentBuilder();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 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.
@@ -94,7 +94,7 @@ public class StringSourceFactory implements SourceFactory {
private synchronized Transformer getTransformer() {
try {
return transformerFactory.newTransformer();
return this.transformerFactory.newTransformer();
}
catch (Exception e) {
throw new MessagingException("Exception creating transformer", e);

View File

@@ -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.
@@ -289,7 +289,7 @@ public class XPathMessageSplitter extends AbstractMessageSplitter {
@Override
public boolean hasNext() {
return index < nodeList.getLength();
return this.index < this.nodeList.getLength();
}
@Override
@@ -298,7 +298,7 @@ public class XPathMessageSplitter extends AbstractMessageSplitter {
return null;
}
Node node = nodeList.item(index++);
Node node = this.nodeList.item(this.index++);
if (this.documentBuilder != null) {
node = convertNodeToDocument(this.documentBuilder, node);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 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.
@@ -58,23 +58,23 @@ public abstract class AbstractXmlTransformer extends AbstractTransformer {
}
public String getResultType() {
return resultType;
return this.resultType;
}
public String getResultFactoryName() {
return resultFactoryName;
return this.resultFactoryName;
}
public ResultFactory getResultFactory() {
return resultFactory;
return this.resultFactory;
}
@Override
protected void onInit() throws Exception {
super.onInit();
ResultFactory generatedResultFactory = configureResultFactory(resultType, resultFactoryName, this.getBeanFactory());
ResultFactory generatedResultFactory = configureResultFactory(this.resultType, this.resultFactoryName, this.getBeanFactory());
if (generatedResultFactory != null) {
resultFactory = generatedResultFactory;
this.resultFactory = generatedResultFactory;
}
}

View File

@@ -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.
@@ -233,7 +233,7 @@ public class XsltPayloadTransformer extends AbstractXmlTransformer implements Be
Transformer transformer = buildTransformer(message);
Object payload;
if (this.alwaysUseSourceFactory) {
payload = sourceFactory.createSource(message.getPayload());
payload = this.sourceFactory.createSource(message.getPayload());
}
else {
payload = message.getPayload();