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:
@@ -192,12 +192,12 @@ public abstract class AbstractFtpSessionFactory<T extends FTPClient> implements
|
||||
|
||||
if (!FTPReply.isPositiveCompletion(client.getReplyCode())) {
|
||||
throw new MessagingException("Connecting to server [" +
|
||||
host + ":" + port + "] failed. Please check the connection.");
|
||||
this.host + ":" + this.port + "] failed. Please check the connection.");
|
||||
}
|
||||
logger.debug("Connected to server [" + host + ":" + port + "]");
|
||||
this.logger.debug("Connected to server [" + this.host + ":" + this.port + "]");
|
||||
|
||||
// Login
|
||||
if (!client.login(username, password)) {
|
||||
if (!client.login(this.username, this.password)) {
|
||||
throw new IllegalStateException("Login failed. The response from the server is: " +
|
||||
client.getReplyString());
|
||||
}
|
||||
@@ -205,9 +205,9 @@ public abstract class AbstractFtpSessionFactory<T extends FTPClient> implements
|
||||
this.postProcessClientAfterConnect(client);
|
||||
|
||||
this.updateClientMode(client);
|
||||
client.setFileType(fileType);
|
||||
client.setBufferSize(bufferSize);
|
||||
client.setControlEncoding(controlEncoding);
|
||||
client.setFileType(this.fileType);
|
||||
client.setBufferSize(this.bufferSize);
|
||||
client.setControlEncoding(this.controlEncoding);
|
||||
return client;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -143,7 +143,7 @@ public class DefaultFtpsSessionFactory extends AbstractFtpSessionFactory<FTPSCli
|
||||
@Override
|
||||
protected void postProcessClientBeforeConnect(FTPSClient ftpsClient) throws IOException {
|
||||
if (StringUtils.hasText(this.authValue)) {
|
||||
ftpsClient.setAuthValue(authValue);
|
||||
ftpsClient.setAuthValue(this.authValue);
|
||||
}
|
||||
if (this.trustManager != null) {
|
||||
ftpsClient.setTrustManager(this.trustManager);
|
||||
@@ -164,7 +164,7 @@ public class DefaultFtpsSessionFactory extends AbstractFtpSessionFactory<FTPSCli
|
||||
ftpsClient.setEnabledSessionCreation(this.sessionCreation);
|
||||
}
|
||||
if (this.keyManager != null) {
|
||||
ftpsClient.setKeyManager(keyManager);
|
||||
ftpsClient.setKeyManager(this.keyManager);
|
||||
}
|
||||
if (this.needClientAuth != null) {
|
||||
ftpsClient.setNeedClientAuth(this.needClientAuth);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class FtpSession implements Session<FTPFile> {
|
||||
public boolean remove(String path) throws IOException {
|
||||
Assert.hasText(path, "path must not be null");
|
||||
if (!this.client.deleteFile(path)) {
|
||||
throw new IOException("Failed to delete '" + path + "'. Server replied with: " + client.getReplyString());
|
||||
throw new IOException("Failed to delete '" + path + "'. Server replied with: " + this.client.getReplyString());
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
@@ -83,7 +83,7 @@ public class FtpSession implements Session<FTPFile> {
|
||||
throw new IOException("Failed to copy '" + path +
|
||||
"'. Server replied with: " + this.client.getReplyString());
|
||||
}
|
||||
logger.info("File has been successfully transferred from: " + path);
|
||||
this.logger.info("File has been successfully transferred from: " + path);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -106,8 +106,8 @@ public class FtpSession implements Session<FTPFile> {
|
||||
}
|
||||
if (this.client.completePendingCommand()) {
|
||||
int replyCode = this.client.getReplyCode();
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(this + " finalizeRaw - reply code: " + replyCode);
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug(this + " finalizeRaw - reply code: " + replyCode);
|
||||
}
|
||||
return FTPReply.isPositiveCompletion(replyCode);
|
||||
}
|
||||
@@ -123,8 +123,8 @@ public class FtpSession implements Session<FTPFile> {
|
||||
throw new IOException("Failed to write to '" + path
|
||||
+ "'. Server replied with: " + this.client.getReplyString());
|
||||
}
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("File has been successfully transferred to: " + path);
|
||||
if (this.logger.isInfoEnabled()) {
|
||||
this.logger.info("File has been successfully transferred to: " + path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,8 +137,8 @@ public class FtpSession implements Session<FTPFile> {
|
||||
throw new IOException("Failed to append to '" + path
|
||||
+ "'. Server replied with: " + this.client.getReplyString());
|
||||
}
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("File has been successfully appended to: " + path);
|
||||
if (this.logger.isInfoEnabled()) {
|
||||
this.logger.info("File has been successfully appended to: " + path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,8 +151,8 @@ public class FtpSession implements Session<FTPFile> {
|
||||
this.client.disconnect();
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("failed to disconnect FTPClient", e);
|
||||
if (this.logger.isWarnEnabled()) {
|
||||
this.logger.warn("failed to disconnect FTPClient", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,8 +176,8 @@ public class FtpSession implements Session<FTPFile> {
|
||||
throw new IOException("Failed to rename '" + pathFrom +
|
||||
"' to " + pathTo + "'. Server replied with: " + this.client.getReplyString());
|
||||
}
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("File has been successfully renamed from: " + pathFrom + " to " + pathTo);
|
||||
if (this.logger.isInfoEnabled()) {
|
||||
this.logger.info("File has been successfully renamed from: " + pathFrom + " to " + pathTo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user