You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by lg...@apache.org on 2018/11/07 18:01:06 UTC
[3/5] mina-sshd git commit: Fixed a few Checkstyle issues
Fixed a few Checkstyle issues
Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/99dd4aae
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/99dd4aae
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/99dd4aae
Branch: refs/heads/master
Commit: 99dd4aae6e7ee37fed459d23734a4efba8da3e57
Parents: 5f4d0f8
Author: Lyor Goldstein <lg...@apache.org>
Authored: Wed Nov 7 07:25:19 2018 +0200
Committer: Lyor Goldstein <lg...@apache.org>
Committed: Wed Nov 7 20:06:39 2018 +0200
----------------------------------------------------------------------
.../apache/sshd/common/util/SelectorUtils.java | 47 ++++++++++----------
.../pubkey/CachingPublicKeyAuthenticator.java | 1 -
.../apache/sshd/common/AttributeStoreTest.java | 1 -
3 files changed, 24 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/99dd4aae/sshd-common/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
----------------------------------------------------------------------
diff --git a/sshd-common/src/main/java/org/apache/sshd/common/util/SelectorUtils.java b/sshd-common/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
index 95975c2..1557c55 100644
--- a/sshd-common/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
+++ b/sshd-common/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
@@ -26,15 +26,15 @@ import java.util.Objects;
import java.util.StringTokenizer;
/**
- * <p>This is a utility class used by selectors and DirectoryScanner. The
+ * <p>
+ * This is a utility class used by selectors and DirectoryScanner. The
* functionality more properly belongs just to selectors, but unfortunately
* DirectoryScanner exposed these as protected methods. Thus we have to
* support any subclasses of DirectoryScanner that may access these methods.
* </p>
* <p>This is a Singleton.</p>
*
- * @author Arnout J. Kuiper
- * <a href="mailto:ajkuiper@wxs.nl">ajkuiper@wxs.nl</a>
+ * @author Arnout J. Kuiper <a href="mailto:ajkuiper@wxs.nl">ajkuiper@wxs.nl</a>
* @author Magesh Umasankar
* @author <a href="mailto:bruce@callenish.com">Bruce Atherton</a>
* @version $Id$
@@ -91,18 +91,19 @@ public final class SelectorUtils {
* @param isCaseSensitive Whether or not matching should be performed
* case sensitively.
* @return whether or not a given path matches the start of a given
- * pattern up to the first "**".
+ * pattern up to the first "**".
*/
- public static boolean matchPatternStart(String pattern, String str,
- boolean isCaseSensitive) {
- if (pattern.length() > (REGEX_HANDLER_PREFIX.length() + PATTERN_HANDLER_SUFFIX.length() + 1)
- && pattern.startsWith(REGEX_HANDLER_PREFIX) && pattern.endsWith(PATTERN_HANDLER_SUFFIX)) {
+ public static boolean matchPatternStart(String pattern, String str, boolean isCaseSensitive) {
+ if ((pattern.length() > (REGEX_HANDLER_PREFIX.length() + PATTERN_HANDLER_SUFFIX.length() + 1))
+ && pattern.startsWith(REGEX_HANDLER_PREFIX)
+ && pattern.endsWith(PATTERN_HANDLER_SUFFIX)) {
// FIXME: ICK! But we can't do partial matches for regex, so we have to reserve judgement until we have
// a file to deal with, or we can definitely say this is an exclusion...
return true;
} else {
- if (pattern.length() > (ANT_HANDLER_PREFIX.length() + PATTERN_HANDLER_SUFFIX.length() + 1)
- && pattern.startsWith(ANT_HANDLER_PREFIX) && pattern.endsWith(PATTERN_HANDLER_SUFFIX)) {
+ if ((pattern.length() > (ANT_HANDLER_PREFIX.length() + PATTERN_HANDLER_SUFFIX.length() + 1))
+ && pattern.startsWith(ANT_HANDLER_PREFIX)
+ && pattern.endsWith(PATTERN_HANDLER_SUFFIX)) {
pattern =
pattern.substring(ANT_HANDLER_PREFIX.length(), pattern.length() - PATTERN_HANDLER_SUFFIX.length());
}
@@ -114,7 +115,8 @@ public final class SelectorUtils {
}
}
- private static boolean matchAntPathPatternStart(String pattern, String str, String separator, boolean isCaseSensitive) {
+ private static boolean matchAntPathPatternStart(
+ String pattern, String str, String separator, boolean isCaseSensitive) {
// When str starts with a File.separator, pattern has to start with a
// File.separator.
// When pattern starts with a File.separator, str has to start with a
@@ -182,17 +184,16 @@ public final class SelectorUtils {
* or <code>false</code> otherwise.
*/
public static boolean matchPath(String pattern, String str, boolean isCaseSensitive) {
- if (pattern.length() > (REGEX_HANDLER_PREFIX.length() + PATTERN_HANDLER_SUFFIX.length() + 1)
- && pattern.startsWith(REGEX_HANDLER_PREFIX) && pattern.endsWith(PATTERN_HANDLER_SUFFIX)) {
- pattern = pattern.substring(REGEX_HANDLER_PREFIX.length(), pattern.length()
- - PATTERN_HANDLER_SUFFIX.length());
-
+ if ((pattern.length() > (REGEX_HANDLER_PREFIX.length() + PATTERN_HANDLER_SUFFIX.length() + 1))
+ && pattern.startsWith(REGEX_HANDLER_PREFIX)
+ && pattern.endsWith(PATTERN_HANDLER_SUFFIX)) {
+ pattern = pattern.substring(REGEX_HANDLER_PREFIX.length(), pattern.length() - PATTERN_HANDLER_SUFFIX.length());
return str.matches(pattern);
} else {
- if (pattern.length() > (ANT_HANDLER_PREFIX.length() + PATTERN_HANDLER_SUFFIX.length() + 1)
- && pattern.startsWith(ANT_HANDLER_PREFIX) && pattern.endsWith(PATTERN_HANDLER_SUFFIX)) {
- pattern =
- pattern.substring(ANT_HANDLER_PREFIX.length(), pattern.length() - PATTERN_HANDLER_SUFFIX.length());
+ if ((pattern.length() > (ANT_HANDLER_PREFIX.length() + PATTERN_HANDLER_SUFFIX.length() + 1))
+ && pattern.startsWith(ANT_HANDLER_PREFIX)
+ && pattern.endsWith(PATTERN_HANDLER_SUFFIX)) {
+ pattern = pattern.substring(ANT_HANDLER_PREFIX.length(), pattern.length() - PATTERN_HANDLER_SUFFIX.length());
}
return matchAntPathPattern(pattern, str, isCaseSensitive);
@@ -461,8 +462,7 @@ public final class SelectorUtils {
int patLength = patIdxTmp - patIdxStart - 1;
int strLength = strIdxEnd - strIdxStart + 1;
int foundIdx = -1;
- strLoop:
- for (int i = 0; i <= strLength - patLength; i++) {
+ strLoop: for (int i = 0; i <= strLength - patLength; i++) {
for (int j = 0; j < patLength; j++) {
ch = patArr[patIdxStart + j + 1];
if (ch != '?' && !equals(ch, strArr[strIdxStart + i + j], isCaseSensitive)) {
@@ -545,7 +545,8 @@ public final class SelectorUtils {
* @see #translateToLocalFileSystemPath(String, char, String)
*/
public static String translateToLocalFileSystemPath(String path, char pathSeparator, FileSystem fs) {
- return translateToLocalFileSystemPath(path, pathSeparator, Objects.requireNonNull(fs, "No target file system").getSeparator());
+ return translateToLocalFileSystemPath(path, pathSeparator,
+ Objects.requireNonNull(fs, "No target file system").getSeparator());
}
/**
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/99dd4aae/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/CachingPublicKeyAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/CachingPublicKeyAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/CachingPublicKeyAuthenticator.java
index 79cac90..a1c2169 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/CachingPublicKeyAuthenticator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/CachingPublicKeyAuthenticator.java
@@ -24,7 +24,6 @@ import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.sshd.common.AttributeRepository;
-import org.apache.sshd.common.AttributeRepository.AttributeKey;
import org.apache.sshd.common.RuntimeSshException;
import org.apache.sshd.common.config.keys.KeyUtils;
import org.apache.sshd.common.util.logging.AbstractLoggingBean;
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/99dd4aae/sshd-core/src/test/java/org/apache/sshd/common/AttributeStoreTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/AttributeStoreTest.java b/sshd-core/src/test/java/org/apache/sshd/common/AttributeStoreTest.java
index 741045e..f30ba0b 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/AttributeStoreTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/AttributeStoreTest.java
@@ -21,7 +21,6 @@ package org.apache.sshd.common;
import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.sshd.common.AttributeRepository.AttributeKey;
import org.apache.sshd.common.channel.Channel;
import org.apache.sshd.common.session.Session;
import org.apache.sshd.util.test.BaseTestSupport;