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:
@@ -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.
|
||||
@@ -415,29 +415,29 @@ public class DefaultSftpSessionFactory implements SessionFactory<LsEntry>, Share
|
||||
jschSession.setUserInfo(this.userInfoWrapper);
|
||||
|
||||
try {
|
||||
if (proxy != null) {
|
||||
jschSession.setProxy(proxy);
|
||||
if (this.proxy != null) {
|
||||
jschSession.setProxy(this.proxy);
|
||||
}
|
||||
if (socketFactory != null) {
|
||||
jschSession.setSocketFactory(socketFactory);
|
||||
if (this.socketFactory != null) {
|
||||
jschSession.setSocketFactory(this.socketFactory);
|
||||
}
|
||||
if (timeout != null) {
|
||||
jschSession.setTimeout(timeout);
|
||||
if (this.timeout != null) {
|
||||
jschSession.setTimeout(this.timeout);
|
||||
}
|
||||
if (StringUtils.hasText(clientVersion)) {
|
||||
jschSession.setClientVersion(clientVersion);
|
||||
if (StringUtils.hasText(this.clientVersion)) {
|
||||
jschSession.setClientVersion(this.clientVersion);
|
||||
}
|
||||
if (StringUtils.hasText(hostKeyAlias)) {
|
||||
jschSession.setHostKeyAlias(hostKeyAlias);
|
||||
if (StringUtils.hasText(this.hostKeyAlias)) {
|
||||
jschSession.setHostKeyAlias(this.hostKeyAlias);
|
||||
}
|
||||
if (serverAliveInterval != null) {
|
||||
jschSession.setServerAliveInterval(serverAliveInterval);
|
||||
if (this.serverAliveInterval != null) {
|
||||
jschSession.setServerAliveInterval(this.serverAliveInterval);
|
||||
}
|
||||
if (serverAliveCountMax != null) {
|
||||
jschSession.setServerAliveCountMax(serverAliveCountMax);
|
||||
if (this.serverAliveCountMax != null) {
|
||||
jschSession.setServerAliveCountMax(this.serverAliveCountMax);
|
||||
}
|
||||
if (enableDaemonThread != null) {
|
||||
jschSession.setDaemonThread(enableDaemonThread);
|
||||
if (this.enableDaemonThread != null) {
|
||||
jschSession.setDaemonThread(this.enableDaemonThread);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
@@ -43,17 +43,17 @@ class JSchSessionWrapper {
|
||||
}
|
||||
|
||||
public void close() {
|
||||
if (channels.decrementAndGet() <= 0) {
|
||||
if (this.channels.decrementAndGet() <= 0) {
|
||||
this.session.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
public final Session getSession() {
|
||||
return session;
|
||||
return this.session;
|
||||
}
|
||||
|
||||
public boolean isConnected() {
|
||||
return session.isConnected();
|
||||
return this.session.isConnected();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -198,14 +198,14 @@ public class SftpSession implements Session<LsEntry> {
|
||||
this.channel.rename(pathFrom, pathTo);
|
||||
}
|
||||
catch (SftpException sftpex) {
|
||||
if (logger.isDebugEnabled()){
|
||||
logger.debug("Initial File rename failed, possibly because file already exists. Will attempt to delete file: "
|
||||
if (this.logger.isDebugEnabled()){
|
||||
this.logger.debug("Initial File rename failed, possibly because file already exists. Will attempt to delete file: "
|
||||
+ pathTo + " and execute rename again.");
|
||||
}
|
||||
try {
|
||||
this.remove(pathTo);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Delete file: " + pathTo + " succeeded. Will attempt rename again");
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug("Delete file: " + pathTo + " succeeded. Will attempt rename again");
|
||||
}
|
||||
}
|
||||
catch (IOException ioex) {
|
||||
@@ -219,8 +219,8 @@ public class SftpSession implements Session<LsEntry> {
|
||||
throw new NestedIOException("failed to rename from " + pathFrom + " to " + pathTo, sftpex2);
|
||||
}
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("File: " + pathFrom + " was successfully renamed to " + pathTo);
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug("File: " + pathFrom + " was successfully renamed to " + pathTo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user