You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by gn...@apache.org on 2015/07/16 15:37:11 UTC
[4/6] mina-sshd git commit: Remove boxing / unboxing,
remove useless final modifiers, use try with resources, fix a few javadocs
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java
index eee2c20..d18efc4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/GenericUtils.java
@@ -58,7 +58,7 @@ public final class GenericUtils {
throw new UnsupportedOperationException("No instance");
}
- public static final String trimToEmpty(String s) {
+ public static String trimToEmpty(String s) {
if (s == null) {
return "";
} else {
@@ -66,7 +66,7 @@ public final class GenericUtils {
}
}
- public static final int safeCompare(String s1, String s2, boolean caseSensitive) {
+ public static int safeCompare(String s1, String s2, boolean caseSensitive) {
if (s1 == s2) {
return 0;
} else if (s1 == null) {
@@ -80,7 +80,7 @@ public final class GenericUtils {
}
}
- public static final int length(CharSequence cs) {
+ public static int length(CharSequence cs) {
if (cs == null) {
return 0;
} else {
@@ -88,7 +88,7 @@ public final class GenericUtils {
}
}
- public static final boolean isEmpty(CharSequence cs) {
+ public static boolean isEmpty(CharSequence cs) {
if (length(cs) <= 0) {
return true;
} else {
@@ -97,7 +97,7 @@ public final class GenericUtils {
}
// a List would be better, but we want to be compatible with String.split(...)
- public static final String[] split(String s, char ch) {
+ public static String[] split(String s, char ch) {
if (isEmpty(s)) {
return EMPTY_STRING_ARRAY;
}
@@ -131,15 +131,15 @@ public final class GenericUtils {
return values.toArray(new String[values.size()]);
}
- public static final <T> String join(T[] values, char ch) {
+ public static <T> String join(T[] values, char ch) {
return join(isEmpty(values) ? Collections.<T>emptyList() : Arrays.asList(values), ch);
}
- public static final String join(Iterable<?> iter, char ch) {
+ public static String join(Iterable<?> iter, char ch) {
return join((iter == null) ? null : iter.iterator(), ch);
}
- public static final String join(Iterator<?> iter, char ch) {
+ public static String join(Iterator<?> iter, char ch) {
if ((iter == null) || (!iter.hasNext())) {
return "";
}
@@ -156,15 +156,15 @@ public final class GenericUtils {
return sb.toString();
}
- public static final <T> String join(T[] values, CharSequence sep) {
+ public static <T> String join(T[] values, CharSequence sep) {
return join(isEmpty(values) ? Collections.<T>emptyList() : Arrays.asList(values), sep);
}
- public static final String join(Iterable<?> iter, CharSequence sep) {
+ public static String join(Iterable<?> iter, CharSequence sep) {
return join((iter == null) ? null : iter.iterator(), sep);
}
- public static final String join(Iterator<?> iter, CharSequence sep) {
+ public static String join(Iterator<?> iter, CharSequence sep) {
if ((iter == null) || (!iter.hasNext())) {
return "";
}
@@ -181,7 +181,7 @@ public final class GenericUtils {
return sb.toString();
}
- public static final int size(Collection<?> c) {
+ public static int size(Collection<?> c) {
if (c == null) {
return 0;
} else {
@@ -189,7 +189,7 @@ public final class GenericUtils {
}
}
- public static final boolean isEmpty(Collection<?> c) {
+ public static boolean isEmpty(Collection<?> c) {
if (size(c) <= 0) {
return true;
} else {
@@ -197,7 +197,7 @@ public final class GenericUtils {
}
}
- public static final int size(Map<?,?> m) {
+ public static int size(Map<?,?> m) {
if (m == null) {
return 0;
} else {
@@ -205,7 +205,7 @@ public final class GenericUtils {
}
}
- public static final boolean isEmpty(Map<?,?> m) {
+ public static boolean isEmpty(Map<?,?> m) {
if (size(m) <= 0) {
return true;
} else {
@@ -213,7 +213,7 @@ public final class GenericUtils {
}
}
- public static final boolean isEmpty(byte[] a) {
+ public static boolean isEmpty(byte[] a) {
if (length(a) <= 0) {
return true;
} else {
@@ -221,7 +221,7 @@ public final class GenericUtils {
}
}
- public static final int length(byte ... a) {
+ public static int length(byte ... a) {
if (a == null) {
return 0;
} else {
@@ -230,7 +230,7 @@ public final class GenericUtils {
}
@SafeVarargs
- public static final <T> int length(T ... a) {
+ public static <T> int length(T ... a) {
if (a == null) {
return 0;
} else {
@@ -238,7 +238,7 @@ public final class GenericUtils {
}
}
- public static final <T> boolean isEmpty(Iterable<? extends T> iter) {
+ public static <T> boolean isEmpty(Iterable<? extends T> iter) {
if (iter == null) {
return true;
} else if (iter instanceof Collection<?>) {
@@ -248,7 +248,7 @@ public final class GenericUtils {
}
}
- public static final <T> boolean isEmpty(Iterator<? extends T> iter) {
+ public static <T> boolean isEmpty(Iterator<? extends T> iter) {
if (iter == null) {
return true;
} else if (iter.hasNext()) {
@@ -259,7 +259,7 @@ public final class GenericUtils {
}
@SafeVarargs
- public static final <T> boolean isEmpty(T ... a) {
+ public static <T> boolean isEmpty(T ... a) {
if (length(a) <= 0) {
return true;
} else {
@@ -268,11 +268,11 @@ public final class GenericUtils {
}
@SafeVarargs // there is no EnumSet.of(...) so we have to provide our own
- public static final <E extends Enum<E>> Set<E> of(E ... values) {
+ public static <E extends Enum<E>> Set<E> of(E ... values) {
return of(isEmpty(values) ? Collections.<E>emptySet() : Arrays.asList(values));
}
- public static final <E extends Enum<E>> Set<E> of(Collection<? extends E> values) {
+ public static <E extends Enum<E>> Set<E> of(Collection<? extends E> values) {
if (isEmpty(values)) {
return Collections.emptySet();
}
@@ -304,12 +304,12 @@ public final class GenericUtils {
};
@SuppressWarnings({ "unchecked", "rawtypes" })
- public static final <V extends Comparable<V>> Comparator<V> naturalComparator() {
+ public static <V extends Comparable<V>> Comparator<V> naturalComparator() {
// TODO for JDK-8 use Comparator.naturalOrder()
return (Comparator) naturalOrderComparator;
}
- public static final <V extends Comparable<V>> SortedSet<V> asSortedSet(Collection<? extends V> values) {
+ public static <V extends Comparable<V>> SortedSet<V> asSortedSet(Collection<? extends V> values) {
// TODO for JDK-8 use Comparator.naturalOrder()
return asSortedSet(GenericUtils.<V>naturalComparator(), values);
}
@@ -320,7 +320,7 @@ public final class GenericUtils {
* @return A {@link SortedSet} containing the values (if any) sorted
* using the provided comparator
*/
- public static final <V> SortedSet<V> asSortedSet(Comparator<? super V> comp, Collection<? extends V> values) {
+ public static <V> SortedSet<V> asSortedSet(Comparator<? super V> comp, Collection<? extends V> values) {
// TODO for JDK-8 return Collections.emptySortedSet()
SortedSet<V> set=new TreeSet<V>(ValidateUtils.checkNotNull(comp, "No comparator"));
if (size(values) > 0) {
@@ -337,9 +337,9 @@ public final class GenericUtils {
* @return If the sequence contains any of the {@link #QUOTES}
* on <U>both</U> ends, then they are stripped, otherwise
* nothing is done
- * @see #stripDelimiters(CharSeqeuence, char)
+ * @see #stripDelimiters(CharSequence, char)
*/
- public static final CharSequence stripQuotes(CharSequence s) {
+ public static CharSequence stripQuotes(CharSequence s) {
if (isEmpty(s)) {
return s;
}
@@ -361,7 +361,7 @@ public final class GenericUtils {
* @return If the sequence contains the delimiter on <U>both</U> ends,
* then it is are stripped, otherwise nothing is done
*/
- public static final CharSequence stripDelimiters(CharSequence s, char delim) {
+ public static CharSequence stripDelimiters(CharSequence s, char delim) {
if (isEmpty(s) || (s.length() < 2)) {
return s;
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/common/util/OsUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/OsUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/OsUtils.java
index 08f1d1b..529899c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/OsUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/OsUtils.java
@@ -28,7 +28,7 @@ public final class OsUtils {
static {
String os = System.getProperty("os.name").toLowerCase();
- win32 = 0 <= os.indexOf("windows");
+ win32 = os.contains("windows");
}
/** @return true if the host is a UNIX system (and not Windows). */
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/common/util/SecurityUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/SecurityUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/SecurityUtils.java
index daa5b13..38ccf45 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/SecurityUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/SecurityUtils.java
@@ -84,10 +84,10 @@ public class SecurityUtils {
getKeyPairGenerator("EC");
hasEcc = Boolean.TRUE;
} catch (Throwable t) {
- hasEcc = Boolean.TRUE;
+ hasEcc = Boolean.FALSE;
}
}
- return hasEcc.booleanValue();
+ return hasEcc;
}
public static synchronized void setSecurityProvider(String securityProvider) {
@@ -96,7 +96,7 @@ public class SecurityUtils {
}
public static synchronized void setRegisterBouncyCastle(boolean registerBouncyCastle) {
- SecurityUtils.registerBouncyCastle = Boolean.valueOf(registerBouncyCastle);
+ SecurityUtils.registerBouncyCastle = registerBouncyCastle;
registrationDone = false;
}
@@ -119,7 +119,7 @@ public class SecurityUtils {
registerBouncyCastle = Boolean.valueOf(prop);
}
}
- if ((securityProvider == null) && ((registerBouncyCastle == null) || registerBouncyCastle.booleanValue())) {
+ if ((securityProvider == null) && ((registerBouncyCastle == null) || registerBouncyCastle)) {
// Use an inner class to avoid a strong dependency from SshServer on BouncyCastle
try {
new BouncyCastleRegistration().call();
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/common/util/ValidateUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/ValidateUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/ValidateUtils.java
index 264e159..097c986 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/ValidateUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/ValidateUtils.java
@@ -30,82 +30,82 @@ public final class ValidateUtils {
throw new UnsupportedOperationException("No instance");
}
- public static final <T> T checkNotNull(T t, String message) {
+ public static <T> T checkNotNull(T t, String message) {
checkTrue(t != null, message);
return t;
}
- public static final <T> T checkNotNull(T t, String message, Object arg) {
+ public static <T> T checkNotNull(T t, String message, Object arg) {
checkTrue(t != null, message, arg);
return t;
}
- public static final <T> T checkNotNull(T t, String message, Object ... args) {
+ public static <T> T checkNotNull(T t, String message, Object ... args) {
checkTrue(t != null, message, args);
return t;
}
- public static final String checkNotNullAndNotEmpty(String t, String message) {
+ public static String checkNotNullAndNotEmpty(String t, String message) {
t = checkNotNull(t, message).trim();
checkTrue(GenericUtils.length(t) > 0, message);
return t;
}
- public static final String checkNotNullAndNotEmpty(String t, String message, Object arg) {
+ public static String checkNotNullAndNotEmpty(String t, String message, Object arg) {
t = checkNotNull(t, message, arg).trim();
checkTrue(GenericUtils.length(t) > 0, message, arg);
return t;
}
- public static final String checkNotNullAndNotEmpty(String t, String message, Object ... args) {
+ public static String checkNotNullAndNotEmpty(String t, String message, Object ... args) {
t = checkNotNull(t, message, args).trim();
checkTrue(GenericUtils.length(t) > 0, message, args);
return t;
}
- public static final <K,V,M extends Map<K,V>> M checkNotNullAndNotEmpty(M t, String message, Object ... args) {
+ public static <K,V,M extends Map<K,V>> M checkNotNullAndNotEmpty(M t, String message, Object ... args) {
t = checkNotNull(t, message, args);
checkTrue(GenericUtils.size(t) > 0, message, args);
return t;
}
- public static final <T,C extends Collection<T>> C checkNotNullAndNotEmpty(C t, String message, Object ... args) {
+ public static <T,C extends Collection<T>> C checkNotNullAndNotEmpty(C t, String message, Object ... args) {
t = checkNotNull(t, message, args);
checkTrue(GenericUtils.size(t) > 0, message, args);
return t;
}
- public static final byte[] checkNotNullAndNotEmpty(byte[] t, String message, Object ... args) {
+ public static byte[] checkNotNullAndNotEmpty(byte[] t, String message, Object ... args) {
t = checkNotNull(t, message, args);
checkTrue(GenericUtils.length(t) > 0, message, args);
return t;
}
- public static final <T> T[] checkNotNullAndNotEmpty(T[] t, String message, Object ... args) {
+ public static <T> T[] checkNotNullAndNotEmpty(T[] t, String message, Object ... args) {
t = checkNotNull(t, message, args);
checkTrue(GenericUtils.length(t) > 0, message, args);
return t;
}
- public static final void checkTrue(boolean flag, String message) {
+ public static void checkTrue(boolean flag, String message) {
if (!flag) {
throwIllegalArgumentException(message, GenericUtils.EMPTY_OBJECT_ARRAY);
}
}
- public static final void checkTrue(boolean flag, String message, Object arg) {
+ public static void checkTrue(boolean flag, String message, Object arg) {
if (!flag) {
throwIllegalArgumentException(message, arg);
}
}
- public static final void checkTrue(boolean flag, String message, Object ... args) {
+ public static void checkTrue(boolean flag, String message, Object ... args) {
if (!flag) {
throwIllegalArgumentException(message, args);
}
}
- public static final void throwIllegalArgumentException(String message, Object ... args) {
+ public static void throwIllegalArgumentException(String message, Object ... args) {
throw new IllegalArgumentException(String.format(message, args));
}
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/BufferUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/BufferUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/BufferUtils.java
index 4a0ca1f..ae037c5 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/BufferUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/BufferUtils.java
@@ -170,7 +170,7 @@ public class BufferUtils {
* @param value The 32-bit value
* @param buf A work buffer to use - must have enough space to contain 4 bytes
* @throws IOException If failed to write the value or work buffer to small
- * @see #writeInt(OutputStream, long, byte[], int, int)
+ * @see #writeInt(OutputStream, int, byte[], int, int)
*/
public static void writeInt(OutputStream output, int value, byte[] buf) throws IOException {
writeUInt(output, value, buf, 0, GenericUtils.length(buf));
@@ -286,7 +286,7 @@ public class BufferUtils {
}
};
- public static final int getNextPowerOf2(int i) {
+ public static int getNextPowerOf2(int i) {
int j = 1;
while (j < i) {
j <<= 1;
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseInputStream.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseInputStream.java b/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseInputStream.java
index 2840c95..c90355e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseInputStream.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseInputStream.java
@@ -37,7 +37,7 @@ public class NoCloseInputStream extends FilterInputStream {
// ignored
}
- public static final InputStream resolveInputStream(InputStream input, boolean okToClose) {
+ public static InputStream resolveInputStream(InputStream input, boolean okToClose) {
if ((input == null) || okToClose) {
return input;
} else {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseOutputStream.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseOutputStream.java b/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseOutputStream.java
index 8ad5456..869acb4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseOutputStream.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseOutputStream.java
@@ -37,7 +37,7 @@ public class NoCloseOutputStream extends FilterOutputStream {
// ignored
}
- public static final OutputStream resolveOutputStream(OutputStream output, boolean okToClose) {
+ public static OutputStream resolveOutputStream(OutputStream output, boolean okToClose) {
if ((output == null) || okToClose) {
return output;
} else {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseReader.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseReader.java b/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseReader.java
index dce570e..223bf85 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseReader.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseReader.java
@@ -36,7 +36,7 @@ public class NoCloseReader extends FilterReader {
// ignored
}
- public static final Reader resolveReader(Reader r, boolean okToClose) {
+ public static Reader resolveReader(Reader r, boolean okToClose) {
if ((r == null) || okToClose) {
return r;
} else {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseWriter.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseWriter.java b/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseWriter.java
index 1286fc2..a4e185f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseWriter.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/io/NoCloseWriter.java
@@ -36,7 +36,7 @@ public class NoCloseWriter extends FilterWriter {
// ignored
}
- public static final Writer resolveWriter(Writer r, boolean okToClose) {
+ public static Writer resolveWriter(Writer r, boolean okToClose) {
if ((r == null) || okToClose) {
return r;
} else {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/common/util/logging/LoggingUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/logging/LoggingUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/logging/LoggingUtils.java
index 9467ee5..4e9aae0 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/logging/LoggingUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/logging/LoggingUtils.java
@@ -60,7 +60,7 @@ public final class LoggingUtils {
* </LI>
* </UL></P>
*/
- public static final boolean isLoggable(Level level, Level threshold) {
+ public static boolean isLoggable(Level level, Level threshold) {
if ((level == null) || (threshold == null)) {
return false;
} else if (Level.OFF.equals(level) || Level.OFF.equals(threshold)) {
@@ -74,7 +74,7 @@ public final class LoggingUtils {
}
}
- public static final SimplifiedLog wrap(final Logger logger) {
+ public static SimplifiedLog wrap(final Logger logger) {
if (logger == null) {
return SimplifiedLog.EMPTY;
} else {
@@ -96,7 +96,7 @@ public final class LoggingUtils {
}
// NOTE: assume that level enabled has been checked !!!
- public static final void logMessage(Logger logger, Level level, Object message, Throwable t) {
+ public static void logMessage(Logger logger, Level level, Object message, Throwable t) {
if ((logger == null) || (level == null) || Level.OFF.equals(level)) {
return;
} else if (Level.SEVERE.equals(level)) {
@@ -126,7 +126,7 @@ public final class LoggingUtils {
* <LI>All other levels return {@link Logger#isTraceEnabled()}</LI>
* </UL>
*/
- public static final boolean isLoggable(Logger logger, Level level) {
+ public static boolean isLoggable(Logger logger, Level level) {
if ((logger == null) || (level == null) || Level.OFF.equals(level)) {
return false;
} else if (Level.SEVERE.equals(level)) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java
index 5b79870..a09e490 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java
@@ -68,7 +68,7 @@ public class ThreadUtils {
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
String name = method.getName();
if ("isShutdown".equals(name)) {
- return Boolean.valueOf(stopped.get());
+ return stopped.get();
} else if ("shutdown".equals(name)) {
stopped.set(true);
return null; // void...
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/Environment.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/Environment.java b/sshd-core/src/main/java/org/apache/sshd/server/Environment.java
index 01d0b96..f834a99 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/Environment.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/Environment.java
@@ -33,24 +33,24 @@ public interface Environment {
/**
* Key for the user environment variable
*/
- public static final String ENV_USER = "USER";
+ String ENV_USER = "USER";
/**
* Key for the lines environment variable. Specifies the number of
* lines visible on the client side. {@link Environment#ENV_LINES} and
* {@link Environment#ENV_COLUMNS} make up the console screen size.
*/
- public static final String ENV_LINES = "LINES";
+ String ENV_LINES = "LINES";
/**
* Key for the columns environment variable. Specifies the number of
* columns visible on the client side. {@link Environment#ENV_LINES} and
* {@link Environment#ENV_COLUMNS} make up the console screen size.
*/
- public static final String ENV_COLUMNS = "COLUMNS";
+ String ENV_COLUMNS = "COLUMNS";
/**
* Key for the term environment variable. Describes the terminal or
* terminal emulation which is in use.
*/
- public static final String ENV_TERM = "TERM";
+ String ENV_TERM = "TERM";
/**
* Retrieve the environment map
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/Signal.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/Signal.java b/sshd-core/src/main/java/org/apache/sshd/server/Signal.java
index 6c9bba6..bfcc406 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/Signal.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/Signal.java
@@ -83,7 +83,7 @@ public enum Signal {
private final int numeric;
- private Signal(int numeric) {
+ Signal(int numeric) {
this.numeric = numeric;
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/auth/CachingPublicKeyAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/CachingPublicKeyAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/CachingPublicKeyAuthenticator.java
index 426bc08..9be7f81 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/CachingPublicKeyAuthenticator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/CachingPublicKeyAuthenticator.java
@@ -51,11 +51,11 @@ public class CachingPublicKeyAuthenticator implements PublickeyAuthenticator, Se
Boolean result = map.get(key);
if (result == null) {
- result = Boolean.valueOf(authenticator.authenticate(username, key, session));
+ result = authenticator.authenticate(username, key, session);
map.put(key, result);
}
- return result.booleanValue();
+ return result;
}
@Override
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthKeyboardInteractive.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthKeyboardInteractive.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthKeyboardInteractive.java
index 0396b35..d38df50 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthKeyboardInteractive.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthKeyboardInteractive.java
@@ -79,7 +79,7 @@ public class UserAuthKeyboardInteractive extends AbstractUserAuth {
throw new SshException("Expected 1 response from user but received " + num);
}
String password = buffer.getString();
- return Boolean.valueOf(checkPassword(session, username, password));
+ return checkPassword(session, username, password);
}
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPassword.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPassword.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPassword.java
index 2f6bd4f..8f658da 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPassword.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/UserAuthPassword.java
@@ -46,7 +46,7 @@ public class UserAuthPassword extends AbstractUserAuth {
throw new IllegalStateException("Password changes are not supported");
}
String password = buffer.getString();
- return Boolean.valueOf(checkPassword(session, username, password));
+ return checkPassword(session, username, password);
}
protected boolean checkPassword(ServerSession session, String username, String password) throws Exception {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/UserAuthGSS.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/UserAuthGSS.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/UserAuthGSS.java
index 9ff8867..d0e5bab 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/UserAuthGSS.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/gss/UserAuthGSS.java
@@ -171,7 +171,7 @@ public class UserAuthGSS extends AbstractUserAuth {
session.writePacket(b);
return null;
} else {
- return Boolean.valueOf(established);
+ return established;
}
}
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/auth/password/StaticPasswordAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/password/StaticPasswordAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/password/StaticPasswordAuthenticator.java
index 3d94108..1633187 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/password/StaticPasswordAuthenticator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/password/StaticPasswordAuthenticator.java
@@ -39,7 +39,7 @@ public class StaticPasswordAuthenticator extends AbstractLoggingBean implements
public final boolean authenticate(String username, String password, ServerSession session) {
boolean accepted = isAccepted();
if (log.isDebugEnabled()) {
- log.debug("authenticate({}[{}]: {}", username, session, Boolean.valueOf(accepted));
+ log.debug("authenticate({}[{}]: {}", username, session, accepted);
}
return accepted;
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/StaticPublickeyAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/StaticPublickeyAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/StaticPublickeyAuthenticator.java
index 041bdea..970aadb 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/StaticPublickeyAuthenticator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/StaticPublickeyAuthenticator.java
@@ -43,7 +43,7 @@ public abstract class StaticPublickeyAuthenticator extends AbstractLoggingBean i
boolean accepted = isAccepted();
if (log.isDebugEnabled()) {
log.debug("authenticate({}[{}][{}][{}]: {}",
- username, session, key.getAlgorithm(), KeyUtils.getFingerPrint(key), Boolean.valueOf(accepted));
+ username, session, key.getAlgorithm(), KeyUtils.getFingerPrint(key), accepted);
}
return accepted;
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java b/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
index c49c41f..60b61c0 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
@@ -306,50 +306,42 @@ public class ChannelSession extends AbstractServerChannel {
* to generate it
*/
public Boolean handleRequest(String type, Buffer buffer) throws IOException {
- if ("env".equals(type)) {
- return Boolean.valueOf(handleEnv(buffer));
- }
- if ("pty-req".equals(type)) {
- return Boolean.valueOf(handlePtyReq(buffer));
- }
- if ("window-change".equals(type)) {
- return Boolean.valueOf(handleWindowChange(buffer));
- }
- if ("signal".equals(type)) {
- return Boolean.valueOf(handleSignal(buffer));
- }
- if ("break".equals(type)) {
- return Boolean.valueOf(handleBreak(buffer));
- }
- if ("shell".equals(type)) {
- if ((this.type == null) && handleShell(buffer)) {
- this.type = type;
- return Boolean.TRUE;
- } else {
- return Boolean.FALSE;
- }
- }
- if ("exec".equals(type)) {
- if ((this.type == null) && handleExec(buffer)) {
- this.type = type;
- return Boolean.TRUE;
- } else {
- return Boolean.FALSE;
- }
- }
- if ("subsystem".equals(type)) {
- if ((this.type == null) && handleSubsystem(buffer)) {
- this.type = type;
- return Boolean.TRUE;
- } else {
- return Boolean.FALSE;
- }
- }
- if ("auth-agent-req@openssh.com".equals(type)) {
- return Boolean.valueOf(handleAgentForwarding(buffer));
- }
- if ("x11-req".equals(type)) {
- return Boolean.valueOf(handleX11Forwarding(buffer));
+ switch (type) {
+ case "env":
+ return handleEnv(buffer);
+ case "pty-req":
+ return handlePtyReq(buffer);
+ case "window-change":
+ return handleWindowChange(buffer);
+ case "signal":
+ return handleSignal(buffer);
+ case "break":
+ return handleBreak(buffer);
+ case "shell":
+ if ((this.type == null) && handleShell(buffer)) {
+ this.type = type;
+ return Boolean.TRUE;
+ } else {
+ return Boolean.FALSE;
+ }
+ case "exec":
+ if ((this.type == null) && handleExec(buffer)) {
+ this.type = type;
+ return Boolean.TRUE;
+ } else {
+ return Boolean.FALSE;
+ }
+ case "subsystem":
+ if ((this.type == null) && handleSubsystem(buffer)) {
+ this.type = type;
+ return Boolean.TRUE;
+ } else {
+ return Boolean.FALSE;
+ }
+ case "auth-agent-req@openssh.com":
+ return handleAgentForwarding(buffer);
+ case "x11-req":
+ return handleX11Forwarding(buffer);
}
return null;
}
@@ -359,7 +351,7 @@ public class ChannelSession extends AbstractServerChannel {
String value = buffer.getString();
addEnvVariable(name, value);
if (log.isDebugEnabled()) {
- log.debug("env for channel {}: {} = {}", Integer.valueOf(id), name, value);
+ log.debug("env for channel {}: {} = {}", id, name, value);
}
return true;
}
@@ -388,14 +380,12 @@ public class ChannelSession extends AbstractServerChannel {
((modes[i++] << 16) & 0x00ff0000) |
((modes[i++] << 8) & 0x0000ff00) |
((modes[i++]) & 0x000000ff);
- ptyModes.put(mode, Integer.valueOf(val));
+ ptyModes.put(mode, val);
}
if (log.isDebugEnabled()) {
log.debug("pty for channel {}: term={}, size=({} - {}), pixels=({}, {}), modes=[{}]",
- Integer.valueOf(id), term,
- Integer.valueOf(tColumns), Integer.valueOf(tRows),
- Integer.valueOf(tWidth), Integer.valueOf(tHeight),
- ptyModes);
+ id, term, tColumns, tRows,
+ tWidth, tHeight, ptyModes);
}
addEnvVariable(Environment.ENV_TERM, term);
@@ -411,9 +401,8 @@ public class ChannelSession extends AbstractServerChannel {
int tHeight = buffer.getInt();
if (log.isDebugEnabled()) {
log.debug("window-change for channel {}: ({} - {}), ({}, {})",
- Integer.valueOf(id),
- Integer.valueOf(tColumns), Integer.valueOf(tRows),
- Integer.valueOf(tWidth), Integer.valueOf(tHeight));
+ id, tColumns, tRows,
+ tWidth, tHeight);
}
final StandardEnvironment e = getEnvironment();
@@ -426,7 +415,7 @@ public class ChannelSession extends AbstractServerChannel {
protected boolean handleSignal(Buffer buffer) throws IOException {
String name = buffer.getString();
if (log.isDebugEnabled()) {
- log.debug("Signal received on channel {}: {}", Integer.valueOf(id), name);
+ log.debug("Signal received on channel {}: {}", id, name);
}
final Signal signal = Signal.get(name);
@@ -441,7 +430,7 @@ public class ChannelSession extends AbstractServerChannel {
protected boolean handleBreak(Buffer buffer) throws IOException {
String name = buffer.getString();
if (log.isDebugEnabled()) {
- log.debug("Break received on channel {}: {}", Integer.valueOf(id), name);
+ log.debug("Break received on channel {}: {}", id, name);
}
getEnvironment().signal(Signal.INT);
@@ -685,7 +674,7 @@ public class ChannelSession extends AbstractServerChannel {
if (r == null) {
return Result.Unsupported;
} else {
- return r.booleanValue() ? Result.ReplySuccess : Result.ReplyFailure;
+ return r ? Result.ReplySuccess : Result.ReplyFailure;
}
}
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/command/ScpCommand.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/command/ScpCommand.java b/sshd-core/src/main/java/org/apache/sshd/server/command/ScpCommand.java
index f9c3fe7..e3660a1 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/command/ScpCommand.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/command/ScpCommand.java
@@ -199,7 +199,7 @@ public class ScpCommand extends AbstractLoggingBean implements Command, Runnable
if ((executors != null) && (!executors.isShutdown()) && shutdownExecutor) {
Collection<Runnable> runners = executors.shutdownNow();
if (log.isDebugEnabled()) {
- log.debug("destroy() - shutdown executor service - runners count=" + ((runners == null) ? 0 : runners.size()));
+ log.debug("destroy() - shutdown executor service - runners count=" + runners.size());
}
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/command/ScpCommandFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/command/ScpCommandFactory.java b/sshd-core/src/main/java/org/apache/sshd/server/command/ScpCommandFactory.java
index 92ba0d5..6f30a17 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/command/ScpCommandFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/command/ScpCommandFactory.java
@@ -218,7 +218,7 @@ public class ScpCommandFactory implements CommandFactory, Cloneable, ExecutorSer
* @return configured {@link Command} instance
* @throws IllegalArgumentException if not an SCP command and no
* delegate command factory is available
- * @see #SCP_COMMAND_PREFIX
+ * @see ScpHelper#SCP_COMMAND_PREFIX
*/
@Override
public Command createCommand(String command) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeyEntry.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeyEntry.java b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeyEntry.java
index 37486b5..846c428 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeyEntry.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeyEntry.java
@@ -132,7 +132,7 @@ public class AuthorizedKeyEntry extends PublicKeyEntry {
;
}
- public static final PublickeyAuthenticator fromAuthorizedEntries(Collection<? extends AuthorizedKeyEntry> entries) throws IOException, GeneralSecurityException {
+ public static PublickeyAuthenticator fromAuthorizedEntries(Collection<? extends AuthorizedKeyEntry> entries) throws IOException, GeneralSecurityException {
Collection<PublicKey> keys = resolveAuthorizedKeys(entries);
if (GenericUtils.isEmpty(keys)) {
return RejectAllPublickeyAuthenticator.INSTANCE;
@@ -141,7 +141,7 @@ public class AuthorizedKeyEntry extends PublicKeyEntry {
}
}
- public static final List<PublicKey> resolveAuthorizedKeys(Collection<? extends AuthorizedKeyEntry> entries) throws IOException, GeneralSecurityException {
+ public static List<PublicKey> resolveAuthorizedKeys(Collection<? extends AuthorizedKeyEntry> entries) throws IOException, GeneralSecurityException {
if (GenericUtils.isEmpty(entries)) {
return Collections.emptyList();
}
@@ -167,7 +167,7 @@ public class AuthorizedKeyEntry extends PublicKeyEntry {
* @return The default {@link File} location of the OpenSSH authorized keys file
*/
@SuppressWarnings("synthetic-access")
- public static final File getDefaultAuthorizedKeysFile() {
+ public static File getDefaultAuthorizedKeysFile() {
return LazyDefaultAuthorizedKeysFileHolder.keysFile;
}
/**
@@ -176,7 +176,7 @@ public class AuthorizedKeyEntry extends PublicKeyEntry {
* or empty if file does not exist
* @throws IOException If failed to read keys from file
*/
- public static final Collection<AuthorizedKeyEntry> readDefaultAuthorizedKeys() throws IOException {
+ public static Collection<AuthorizedKeyEntry> readDefaultAuthorizedKeys() throws IOException {
File keysFile=getDefaultAuthorizedKeysFile();
if (keysFile.exists()) {
return readAuthorizedKeys(keysFile);
@@ -192,7 +192,7 @@ public class AuthorizedKeyEntry extends PublicKeyEntry {
* @throws IOException If failed to read or parse the entries
* @see #readAuthorizedKeys(InputStream, boolean)
*/
- public static final Collection<AuthorizedKeyEntry> readAuthorizedKeys(URL url) throws IOException {
+ public static Collection<AuthorizedKeyEntry> readAuthorizedKeys(URL url) throws IOException {
return readAuthorizedKeys(url.openStream(), true);
}
@@ -203,7 +203,7 @@ public class AuthorizedKeyEntry extends PublicKeyEntry {
* @throws IOException If failed to read or parse the entries
* @see #readAuthorizedKeys(InputStream, boolean)
*/
- public static final Collection<AuthorizedKeyEntry> readAuthorizedKeys(File file) throws IOException {
+ public static Collection<AuthorizedKeyEntry> readAuthorizedKeys(File file) throws IOException {
return readAuthorizedKeys(new FileInputStream(file), true);
}
@@ -217,7 +217,7 @@ public class AuthorizedKeyEntry extends PublicKeyEntry {
* @see #readAuthorizedKeys(InputStream, boolean)
* @see Files#newInputStream(Path, OpenOption...)
*/
- public static final Collection<AuthorizedKeyEntry> readAuthorizedKeys(Path path, OpenOption ... options) throws IOException {
+ public static Collection<AuthorizedKeyEntry> readAuthorizedKeys(Path path, OpenOption ... options) throws IOException {
return readAuthorizedKeys(Files.newInputStream(path, options), true);
}
@@ -228,7 +228,7 @@ public class AuthorizedKeyEntry extends PublicKeyEntry {
* @throws IOException If failed to read or parse the entries
* @see #readAuthorizedKeys(InputStream, boolean)
*/
- public static final Collection<AuthorizedKeyEntry> readAuthorizedKeys(String filePath) throws IOException {
+ public static Collection<AuthorizedKeyEntry> readAuthorizedKeys(String filePath) throws IOException {
return readAuthorizedKeys(new FileInputStream(filePath), true);
}
@@ -241,7 +241,7 @@ public class AuthorizedKeyEntry extends PublicKeyEntry {
* @throws IOException If failed to read or parse the entries
* @see #readAuthorizedKeys(Reader, boolean)
*/
- public static final Collection<AuthorizedKeyEntry> readAuthorizedKeys(InputStream in, boolean okToClose) throws IOException {
+ public static Collection<AuthorizedKeyEntry> readAuthorizedKeys(InputStream in, boolean okToClose) throws IOException {
try(Reader rdr=new InputStreamReader(NoCloseInputStream.resolveInputStream(in, okToClose), StandardCharsets.UTF_8)) {
return readAuthorizedKeys(rdr, true);
}
@@ -256,7 +256,7 @@ public class AuthorizedKeyEntry extends PublicKeyEntry {
* @throws IOException If failed to read or parse the entries
* @see #readAuthorizedKeys(BufferedReader)
*/
- public static final Collection<AuthorizedKeyEntry> readAuthorizedKeys(Reader rdr, boolean okToClose) throws IOException {
+ public static Collection<AuthorizedKeyEntry> readAuthorizedKeys(Reader rdr, boolean okToClose) throws IOException {
try(BufferedReader buf=new BufferedReader(NoCloseReader.resolveReader(rdr, okToClose))) {
return readAuthorizedKeys(buf);
}
@@ -269,7 +269,7 @@ public class AuthorizedKeyEntry extends PublicKeyEntry {
* @throws IOException If failed to read or parse the entries
* @see #parseAuthorizedKeyEntry(String)
*/
- public static final Collection<AuthorizedKeyEntry> readAuthorizedKeys(BufferedReader rdr) throws IOException {
+ public static Collection<AuthorizedKeyEntry> readAuthorizedKeys(BufferedReader rdr) throws IOException {
Collection<AuthorizedKeyEntry> entries=null;
for (String line=rdr.readLine(); line != null; line=rdr.readLine()) {
@@ -303,7 +303,7 @@ public class AuthorizedKeyEntry extends PublicKeyEntry {
* @throws IllegalArgumentException If failed to parse/decode the line
* @see #COMMENT_CHAR
*/
- public static final AuthorizedKeyEntry parseAuthorizedKeyEntry(String line) throws IllegalArgumentException {
+ public static AuthorizedKeyEntry parseAuthorizedKeyEntry(String line) throws IllegalArgumentException {
if (GenericUtils.isEmpty(line) || (line.charAt(0) == COMMENT_CHAR) /* comment ? */) {
return null;
}
@@ -337,7 +337,7 @@ public class AuthorizedKeyEntry extends PublicKeyEntry {
return entry;
}
- public static final Map<String,String> parseLoginOptions(String options) {
+ public static Map<String,String> parseLoginOptions(String options) {
// TODO add support if quoted values contain ','
String[] pairs=GenericUtils.split(options, ',');
if (GenericUtils.isEmpty(pairs)) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/forward/ForwardingFilter.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/forward/ForwardingFilter.java b/sshd-core/src/main/java/org/apache/sshd/server/forward/ForwardingFilter.java
index 4570bdb..8e6f8b4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/forward/ForwardingFilter.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/forward/ForwardingFilter.java
@@ -103,7 +103,7 @@ public interface ForwardingFilter {
* @see #fromName(String)
* @see #fromEnumName(String)
*/
- public static final Type fromString(String name) {
+ public static Type fromString(String name) {
if (GenericUtils.isEmpty(name)) {
return null;
}
@@ -121,7 +121,7 @@ public interface ForwardingFilter {
* @return The matching {@link Type} value - case <U>insensitive</U>,
* or {@code null} if no match found
*/
- public static final Type fromName(String name) {
+ public static Type fromName(String name) {
return NamedResource.Utils.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES);
}
@@ -130,7 +130,7 @@ public interface ForwardingFilter {
* @return The matching {@link Type} value - case <U>insensitive</U>,
* or {@code null} if no match found
*/
- public static final Type fromEnumName(String name) {
+ public static Type fromEnumName(String name) {
if (GenericUtils.isEmpty(name)) {
return null;
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java b/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java
index bca3f0d..2afc135 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java
@@ -112,7 +112,7 @@ public class TcpipServerChannel extends AbstractServerChannel {
int originatorPort = buffer.getInt();
if (log.isDebugEnabled()) {
log.debug("Receiving request for direct tcpip: hostToConnect={}, portToConnect={}, originatorIpAddress={}, originatorPort={}",
- hostToConnect, Integer.valueOf(portToConnect), originatorIpAddress, Integer.valueOf(originatorPort));
+ hostToConnect, portToConnect, originatorIpAddress, originatorPort);
}
final SshdSocketAddress address;
@@ -226,7 +226,7 @@ public class TcpipServerChannel extends AbstractServerChannel {
if ((executors != null) && (!executors.isShutdown()) && shutdown) {
Collection<Runnable> runners = executors.shutdownNow();
if (log.isDebugEnabled()) {
- log.debug("destroy() - shutdown executor service - runners count=" + ((runners == null) ? 0 : runners.size()));
+ log.debug("destroy() - shutdown executor service - runners count=" + runners.size());
}
}
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/jaas/JaasPasswordAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/jaas/JaasPasswordAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/jaas/JaasPasswordAuthenticator.java
index afcee62..b3a21ff 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/jaas/JaasPasswordAuthenticator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/jaas/JaasPasswordAuthenticator.java
@@ -68,13 +68,13 @@ public class JaasPasswordAuthenticator extends AbstractLoggingBean implements Pa
LoginContext loginContext = new LoginContext(domain, subject, new CallbackHandler() {
@Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
- for (int i = 0; i < callbacks.length; i++) {
- if (callbacks[i] instanceof NameCallback) {
- ((NameCallback) callbacks[i]).setName(username);
- } else if (callbacks[i] instanceof PasswordCallback) {
- ((PasswordCallback) callbacks[i]).setPassword(password.toCharArray());
+ for (Callback callback : callbacks) {
+ if (callback instanceof NameCallback) {
+ ((NameCallback) callback).setName(username);
+ } else if (callback instanceof PasswordCallback) {
+ ((PasswordCallback) callback).setPassword(password.toCharArray());
} else {
- throw new UnsupportedCallbackException(callbacks[i]);
+ throw new UnsupportedCallbackException(callback);
}
}
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/kex/AbstractDHServerKeyExchange.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/kex/AbstractDHServerKeyExchange.java b/sshd-core/src/main/java/org/apache/sshd/server/kex/AbstractDHServerKeyExchange.java
index 0b7076b..52324ca 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/kex/AbstractDHServerKeyExchange.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/kex/AbstractDHServerKeyExchange.java
@@ -41,12 +41,12 @@ public abstract class AbstractDHServerKeyExchange extends AbstractDHKeyExchange
@Override
public void init(AbstractSession s, byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C) throws Exception {
super.init(s, V_S, V_C, I_S, I_C);
- ValidateUtils.checkTrue(s instanceof ServerSession, "Using a server side KeyExchange on a client", GenericUtils.EMPTY_OBJECT_ARRAY);
+ ValidateUtils.checkTrue(s instanceof ServerSession, "Using a server side KeyExchange on a client");
session = (ServerSession) s;
}
@Override
public PublicKey getServerKey() {
- return ValidateUtils.checkNotNull(session.getHostKey(), "No server key pair available", GenericUtils.EMPTY_OBJECT_ARRAY).getPublic();
+ return ValidateUtils.checkNotNull(session.getHostKey(), "No server key pair available").getPublic();
}
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/kex/Moduli.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/kex/Moduli.java b/sshd-core/src/main/java/org/apache/sshd/server/kex/Moduli.java
index f51f2ec..c9e59da 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/kex/Moduli.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/kex/Moduli.java
@@ -44,8 +44,7 @@ public class Moduli {
public static List<DhGroup> parseModuli(URL url) throws IOException {
List<DhGroup> groups = new ArrayList<DhGroup>();
- BufferedReader r = new BufferedReader(new InputStreamReader(url.openStream()));
- try {
+ try (BufferedReader r = new BufferedReader(new InputStreamReader(url.openStream()))) {
String line;
while ((line = r.readLine()) != null) {
line = line.trim();
@@ -79,8 +78,6 @@ public class Moduli {
groups.add(group);
}
return groups;
- } finally {
- r.close();
}
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java b/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
index c29663f..50b2eb6 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/session/ServerUserAuthService.java
@@ -168,7 +168,7 @@ public class ServerUserAuthService extends CloseableUtils.AbstractCloseable impl
if (authed == null) {
// authentication is still ongoing
log.debug("Authentication not finished");
- } else if (authed.booleanValue()) {
+ } else if (authed) {
log.debug("Authentication succeeded");
String username = currentAuth.getUserName();
@@ -185,7 +185,7 @@ public class ServerUserAuthService extends CloseableUtils.AbstractCloseable impl
Integer maxSessionCount = FactoryManagerUtils.getInteger(manager, ServerFactoryManager.MAX_CONCURRENT_SESSIONS);
if (maxSessionCount != null) {
int currentSessionCount = session.getActiveSessionCountForUser(username);
- if (currentSessionCount >= maxSessionCount.intValue()) {
+ if (currentSessionCount >= maxSessionCount) {
session.disconnect(SshConstants.SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE,
"Too many concurrent connections (" + currentSessionCount + ") - max. allowed: " + maxSessionCount);
return;
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/1c80bb65/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
index b62e0e1..39b6284 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
@@ -627,7 +627,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
int id = buffer.getInt();
if (log.isDebugEnabled()) {
log.debug("process(length={}, type={}, id={})",
- Integer.valueOf(length), Integer.valueOf(type), Integer.valueOf(id));
+ length, type, id);
}
switch (type) {
@@ -777,13 +777,13 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
Path abs = file.toAbsolutePath();
Path nrm = abs.normalize();
if (log.isDebugEnabled()) {
- log.debug("doSpaceAvailable(id={}) path={}[{}]", Integer.valueOf(id), path, nrm);
+ log.debug("doSpaceAvailable(id={}) path={}[{}]", id, path, nrm);
}
FileStore store = Files.getFileStore(nrm);
if (log.isTraceEnabled()) {
log.trace("doSpaceAvailable(id={}) path={}[{}] - {}[{}]",
- Integer.valueOf(id), path, nrm, store.name(), store.type());
+ id, path, nrm, store.name(), store.type());
}
return new SpaceAvailableExtensionInfo(store);
@@ -989,7 +989,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
byte[] hashValue = digest.digest(); // NOTE: this also resets the hash for the next read
if (log.isTraceEnabled()) {
log.trace("doCheckFileHash({})[{}] offset={}, length={} - hash={}",
- file, Integer.valueOf(count), Long.valueOf(startOffset), Long.valueOf(length),
+ file, count, startOffset, length,
BufferUtils.printHex(':', hashValue));
}
buffer.putBytes(hashValue);
@@ -1008,7 +1008,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
hashValue = doMD5Hash(id, targetType, target, startOffset, length, quickCheckHash);
if (log.isTraceEnabled()) {
log.debug("doMD5Hash({})[{}] offset={}, length={}, quick-hash={} - hash={}",
- targetType, target, Long.valueOf(startOffset), Long.valueOf(length), BufferUtils.printHex(':', quickCheckHash),
+ targetType, target, startOffset, length, BufferUtils.printHex(':', quickCheckHash),
BufferUtils.printHex(':', hashValue));
}
@@ -1028,7 +1028,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
protected byte[] doMD5Hash(int id, String targetType, String target, long startOffset, long length, byte[] quickCheckHash) throws Exception {
if (log.isDebugEnabled()) {
log.debug("doMD5Hash({})[{}] offset={}, length={}, quick-hash={}",
- targetType, target, Long.valueOf(startOffset), Long.valueOf(length), BufferUtils.printHex(':', quickCheckHash));
+ targetType, target, startOffset, length, BufferUtils.printHex(':', quickCheckHash));
}
Path path;
@@ -1127,7 +1127,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
} else {
if (log.isTraceEnabled()) {
log.trace("doMD5Hash({}) offset={}, length={} - quick-hash mismatched expected={}, actual={}",
- path, Long.valueOf(startOffset), Long.valueOf(length),
+ path, startOffset, length,
BufferUtils.printHex(':', quickCheckHash), BufferUtils.printHex(':', hashValue));
}
}
@@ -1160,7 +1160,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
if (log.isTraceEnabled()) {
log.trace("doMD5Hash({}) offset={}, length={} - matches={}, quick={} hash={}",
- path, Long.valueOf(startOffset), Long.valueOf(length), Boolean.valueOf(hashMatches),
+ path, startOffset, length, hashMatches,
BufferUtils.printHex(':', quickCheckHash), BufferUtils.printHex(':', hashValue));
}
@@ -1187,7 +1187,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
if (result == null) { // response sent internally
session.close(true);
return;
- } if (result.booleanValue()) {
+ } if (result) {
version = Integer.parseInt(proposed);
sendStatus(BufferUtils.clear(buffer), id, SSH_FX_OK, "");
} else {
@@ -1249,17 +1249,17 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
// check if user wants to use a specific version
Integer sftpVersion = FactoryManagerUtils.getInteger(session, SFTP_VERSION);
if (sftpVersion != null) {
- int forcedValue = sftpVersion.intValue();
+ int forcedValue = sftpVersion;
if ((forcedValue < LOWER_SFTP_IMPL) || (forcedValue > HIGHER_SFTP_IMPL)) {
throw new IllegalStateException("Forced SFTP version (" + sftpVersion + ") not within supported values: " + available);
}
- low = hig = sftpVersion.intValue();
+ low = hig = sftpVersion;
available = sftpVersion.toString();
}
if (log.isTraceEnabled()) {
log.trace("checkVersionCompatibility(id={}) - proposed={}, available={}",
- Integer.valueOf(id), Integer.valueOf(proposed), available);
+ id, proposed, available);
}
if ((proposed < low) || (proposed > hig)) {
@@ -1290,7 +1290,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
Handle p = handles.get(handle);
if (log.isDebugEnabled()) {
log.debug("Received SSH_FXP_BLOCK (handle={}[{}], offset={}, length={}, mask=0x{})",
- handle, p, Long.valueOf(offset), Long.valueOf(length), Integer.toHexString(mask));
+ handle, p, offset, length, Integer.toHexString(mask));
}
FileHandle fileHandle = validateHandle(handle, p, FileHandle.class);
@@ -1316,7 +1316,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
Handle p = handles.get(handle);
if (log.isDebugEnabled()) {
log.debug("Received SSH_FXP_UNBLOCK (handle={}[{}], offset={}, length={})",
- handle, p, Long.valueOf(offset), Long.valueOf(length));
+ handle, p, offset, length);
}
FileHandle fileHandle = validateHandle(handle, p, FileHandle.class);
@@ -1341,7 +1341,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
protected void doLink(int id, String targetPath, String linkPath, boolean symLink) throws IOException {
if (log.isDebugEnabled()) {
log.debug("Received SSH_FXP_LINK (linkpath={}, targetpath={}, symlink={})",
- linkPath, targetPath, Boolean.valueOf(symLink));
+ linkPath, targetPath, symLink);
}
Path link = resolveFile(linkPath);
@@ -1461,8 +1461,8 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
if (log.isDebugEnabled()) {
log.debug("SSH_FXP_EXTENDED[{}] read={}[{}], read-offset={}, read-length={}, write={}[{}], write-offset={})",
SftpConstants.EXT_COPYDATA,
- readHandle, rh, Long.valueOf(readOffset), Long.valueOf(readLength),
- writeHandle, wh, Long.valueOf(writeOffset));
+ readHandle, rh, readOffset, readLength,
+ writeHandle, wh, writeOffset);
}
FileHandle srcHandle = validateHandle(readHandle, rh, FileHandle.class);
@@ -1545,7 +1545,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
protected void doCopyFile(int id, String srcFile, String dstFile, boolean overwriteDestination) throws IOException {
if (log.isDebugEnabled()) {
log.debug("SSH_FXP_EXTENDED[{}] (src={}, dst={}, overwrite=0x{})",
- SftpConstants.EXT_COPYFILE, srcFile, dstFile, Boolean.valueOf(overwriteDestination));
+ SftpConstants.EXT_COPYFILE, srcFile, dstFile, overwriteDestination);
}
doCopyFile(id, srcFile, dstFile,
@@ -1627,7 +1627,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
if (control == SSH_FXP_REALPATH_STAT_IF) {
if (status == null) {
attrs = handleUnknownStatusFileAttributes(p, SSH_FILEXFER_ATTR_ALL, options);
- } else if (status.booleanValue()) {
+ } else if (status) {
try {
attrs = getAttributes(p, IoUtils.getLinkOptions(false));
} catch (IOException e) {
@@ -1644,7 +1644,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
} else if (control == SSH_FXP_REALPATH_STAT_ALWAYS) {
if (status == null) {
attrs = handleUnknownStatusFileAttributes(p, SSH_FILEXFER_ATTR_ALL, options);
- } else if (status.booleanValue()) {
+ } else if (status) {
attrs = getAttributes(p, options);
} else {
throw new FileNotFoundException(p.toString());
@@ -1695,7 +1695,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
Path abs = f.toAbsolutePath();
Path p = abs.normalize();
Boolean status = IoUtils.checkFileExists(p, options);
- return new Pair<Path, Boolean>(p, status);
+ return new Pair<>(p, status);
}
protected void doRemoveDirectory(Buffer buffer, int id) throws IOException {
@@ -1744,7 +1744,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
throw new AccessDeniedException("Cannot validate make-directory existence for " + p);
}
- if (status.booleanValue()) {
+ if (status) {
if (Files.isDirectory(p, options)) {
throw new FileAlreadyExistsException(p.toString(), p.toString(), "Target directory already exists");
} else {
@@ -1778,7 +1778,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
if (status == null) {
throw new AccessDeniedException("Cannot determine existence of remove candidate: " + p);
}
- if (!status.booleanValue()) {
+ if (!status) {
throw new FileNotFoundException(p.toString());
} else if (Files.isDirectory(p, options)) {
throw new FileNotFoundException(p.toString() + " is as a folder");
@@ -1806,7 +1806,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
throw new AccessDeniedException("Cannot determine existence of read-dir for " + file);
}
- if (!status.booleanValue()) {
+ if (!status) {
throw new FileNotFoundException(file.toString());
} else if (!Files.isDirectory(file, options)) {
throw new NotDirectoryException(file.toString());
@@ -1828,7 +1828,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
int count = doReadDir(id, dh, reply, FactoryManagerUtils.getIntProperty(session, MAX_PACKET_LENGTH_PROP, DEFAULT_MAX_PACKET_LENGTH));
BufferUtils.updateLengthPlaceholder(reply, lenPos, count);
if (log.isDebugEnabled()) {
- log.debug("doReadDir({})[{}] - sent {} entries", handle, h, Integer.valueOf(count));
+ log.debug("doReadDir({})[{}] - sent {} entries", handle, h, count);
}
if ((!dh.isSendDot()) && (!dh.isSendDotDot()) && (!dh.hasNext())) {
// if no more files to send
@@ -1873,7 +1873,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
throw new AccessDeniedException("Cannot determine open-dir existence for " + p);
}
- if (!status.booleanValue()) {
+ if (!status) {
throw new FileNotFoundException(path);
} else if (!Files.isDirectory(p, options)) {
throw new NotDirectoryException(path);
@@ -1999,7 +1999,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
Handle h = handles.get(handle);
if (log.isDebugEnabled()) {
log.debug("Received SSH_FXP_WRITE (handle={}[{}], offset={}, data=byte[{}])",
- handle, h, Long.valueOf(offset), Integer.valueOf(length));
+ handle, h, offset, length);
}
FileHandle fh = validateHandle(handle, h, FileHandle.class);
@@ -2046,7 +2046,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
Handle h = handles.get(handle);
if (log.isDebugEnabled()) {
log.debug("Received SSH_FXP_READ (handle={}[{}], offset={}, length={})",
- handle, h, Long.valueOf(offset), Integer.valueOf(length));
+ handle, h, offset, length);
}
ValidateUtils.checkTrue(length > 0, "Invalid read length: %d", length);
FileHandle fh = validateHandle(handle, h, FileHandle.class);
@@ -2559,7 +2559,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
Number length = (Number) attributes.get("size");
if (length == null) {
- length = Long.valueOf(0L);
+ length = 0L;
}
String lengthString = String.format("%1$8s", length);
@@ -2571,23 +2571,13 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
perms = EnumSet.noneOf(PosixFilePermission.class);
}
- StringBuilder sb = new StringBuilder();
- sb.append((isDirectory != null && isDirectory.booleanValue()) ? "d" : (isLink != null && isLink.booleanValue()) ? "l" : "-");
- sb.append(PosixFilePermissions.toString(perms));
- sb.append(" ");
- sb.append(attributes.containsKey("nlink") ? attributes.get("nlink") : "1");
- sb.append(" ");
- sb.append(username);
- sb.append(" ");
- sb.append(group);
- sb.append(" ");
- sb.append(lengthString);
- sb.append(" ");
- sb.append(getUnixDate((FileTime) attributes.get("lastModifiedTime")));
- sb.append(" ");
- sb.append(getShortName(f));
-
- return sb.toString();
+ return (getBool(isDirectory) ? "d" :
+ (getBool(isLink) ? "l" : "-"))
+ + PosixFilePermissions.toString(perms) + " "
+ + (attributes.containsKey("nlink") ? attributes.get("nlink") : "1")
+ + " " + username + " " + group + " " + lengthString + " "
+ + getUnixDate((FileTime) attributes.get("lastModifiedTime"))
+ + " " + getShortName(f);
}
protected String getShortName(Path f) throws IOException {
@@ -2663,7 +2653,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
Boolean status = IoUtils.checkFileExists(file, options);
if (status == null) {
return handleUnknownStatusFileAttributes(file, flags, options);
- } else if (!status.booleanValue()) {
+ } else if (!status) {
throw new FileNotFoundException(file.toString());
} else {
return getAttributes(file, flags, options);
@@ -2751,7 +2741,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
}
protected boolean getBool(Boolean bool) {
- return (bool != null) && bool.booleanValue();
+ return bool != null && bool;
}
protected Map<String, Object> getAttributes(Path file, LinkOption ... options) throws IOException {
@@ -2783,7 +2773,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
Collection<String> views;
if (GenericUtils.isEmpty(supportedViews)) {
- views = Collections.<String>emptyList();
+ views = Collections.emptyList();
} else if (supportedViews.contains("unix")) {
views = DEFAULT_UNIX_VIEW;
} else {
@@ -3013,14 +3003,14 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
}
}
if ((flags & SSH_FILEXFER_ATTR_SIZE) != 0) {
- attrs.put("size", Long.valueOf(buffer.getLong()));
+ attrs.put("size", buffer.getLong());
}
if ((flags & SSH_FILEXFER_ATTR_ALLOCATION_SIZE) != 0) {
- attrs.put("allocationSize", Long.valueOf(buffer.getLong()));
+ attrs.put("allocationSize", buffer.getLong());
}
if ((flags & SSH_FILEXFER_ATTR_UIDGID) != 0) {
- attrs.put("uid", Integer.valueOf(buffer.getInt()));
- attrs.put("gid", Integer.valueOf(buffer.getInt()));
+ attrs.put("uid", buffer.getInt());
+ attrs.put("gid", buffer.getInt());
}
if ((flags & SSH_FILEXFER_ATTR_OWNERGROUP) != 0) {
attrs.put("owner", new DefaultGroupPrincipal(buffer.getString()));
@@ -3260,7 +3250,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
protected void sendStatus(Buffer buffer, int id, int substatus, String msg, String lang) throws IOException {
if (log.isDebugEnabled()) {
log.debug("Send SSH_FXP_STATUS (substatus={}, lang={}, msg={})",
- Integer.valueOf(substatus), lang, msg);
+ substatus, lang, msg);
}
buffer.putByte((byte) SSH_FXP_STATUS);
@@ -3302,7 +3292,7 @@ public class SftpSubsystem extends AbstractLoggingBean implements Command, Runna
if ((executors != null) && (!executors.isShutdown()) && shutdownExecutor) {
Collection<Runnable> runners = executors.shutdownNow();
if (log.isDebugEnabled()) {
- log.debug("destroy() - shutdown executor service - runners count=" + ((runners == null) ? 0 : runners.size()));
+ log.debug("destroy() - shutdown executor service - runners count=" + runners.size());
}
}