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-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.
@@ -79,11 +79,11 @@ public class ByteStreamReadingMessageSource extends IntegrationObjectSupport imp
byte[] bytes;
int bytesRead = 0;
synchronized (this.streamMonitor) {
if (stream.available() == 0) {
if (this.stream.available() == 0) {
return null;
}
bytes = new byte[bytesPerMessage];
bytesRead = stream.read(bytes, 0, bytes.length);
bytes = new byte[this.bytesPerMessage];
bytesRead = this.stream.read(bytes, 0, bytes.length);
}
if (bytesRead <= 0) {
return null;

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.
@@ -62,8 +62,8 @@ public class ByteStreamWritingMessageHandler extends AbstractMessageHandler {
protected void handleMessageInternal(Message<?> message) {
Object payload = message.getPayload();
if (payload == null) {
if (logger.isWarnEnabled()) {
logger.warn(this.getClass().getSimpleName() + " received null object");
if (this.logger.isWarnEnabled()) {
this.logger.warn(this.getClass().getSimpleName() + " received null object");
}
return;
}

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.
@@ -137,14 +137,14 @@ public class CharacterStreamWritingMessageHandler extends AbstractMessageHandler
protected void handleMessageInternal(Message<?> message) {
Object payload = message.getPayload();
if (payload == null) {
if (logger.isWarnEnabled()) {
logger.warn("target received null payload");
if (this.logger.isWarnEnabled()) {
this.logger.warn("target received null payload");
}
return;
}
try {
if (payload instanceof String) {
writer.write((String) payload);
this.writer.write((String) payload);
}
else if (payload instanceof char[]) {
this.writer.write((char[]) payload);
@@ -157,12 +157,12 @@ public class CharacterStreamWritingMessageHandler extends AbstractMessageHandler
((Exception) payload).printStackTrace(printWriter);
}
else {
writer.write(payload.toString());
this.writer.write(payload.toString());
}
if (this.shouldAppendNewLine) {
writer.newLine();
this.writer.newLine();
}
writer.flush();
this.writer.flush();
}
catch (IOException e) {
throw new MessagingException("IO failure occurred in target", e);