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 2016/09/15 19:34:39 UTC
[02/16] mina-sshd git commit: [SSHD-698] Code cleanup
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/VersionsParser.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/VersionsParser.java b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/VersionsParser.java
index 7299a3c..51b31f6 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/VersionsParser.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/subsystem/sftp/extensions/VersionsParser.java
@@ -78,6 +78,6 @@ public class VersionsParser extends AbstractParser<Versions> {
public Versions parse(String value) {
String[] comps = GenericUtils.split(value, Versions.SEP);
- return new Versions(GenericUtils.isEmpty(comps) ? Collections.<String>emptyList() : Arrays.asList(comps));
+ return new Versions(GenericUtils.isEmpty(comps) ? Collections.emptyList() : Arrays.asList(comps));
}
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/util/EventListenerUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/EventListenerUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/EventListenerUtils.java
index 51f7dd5..72b16b9 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/EventListenerUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/EventListenerUtils.java
@@ -104,7 +104,7 @@ public final class EventListenerUtils {
* instance is actually contained
*/
public static <L extends EventListener> Set<L> synchronizedListenersSet(Collection<? extends L> listeners) {
- Set<L> s = EventListenerUtils.<L>synchronizedListenersSet();
+ Set<L> s = EventListenerUtils.synchronizedListenersSet();
if (GenericUtils.size(listeners) > 0) {
s.addAll(listeners);
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/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 5516e44..ba58385 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
@@ -251,7 +251,7 @@ public final class GenericUtils {
@SafeVarargs // there is no EnumSet.of(...) so we have to provide our own
public static <E extends Enum<E>> Set<E> of(E... values) {
- return of(isEmpty(values) ? Collections.<E>emptySet() : Arrays.asList(values));
+ return of(isEmpty(values) ? Collections.emptySet() : Arrays.asList(values));
}
public static <E extends Enum<E>> Set<E> of(Collection<? extends E> values) {
@@ -311,7 +311,7 @@ public final class GenericUtils {
*/
@SafeVarargs
public static <V> SortedSet<V> asSortedSet(Comparator<? super V> comp, V ... values) {
- return asSortedSet(comp, isEmpty(values) ? Collections.<V>emptyList() : Arrays.asList(values));
+ return asSortedSet(comp, isEmpty(values) ? Collections.emptyList() : Arrays.asList(values));
}
/**
@@ -355,7 +355,7 @@ public final class GenericUtils {
@SafeVarargs
public static <K, V> Map<K, V> mapValues(
Transformer<? super V, ? extends K> keyMapper, Factory<? extends Map<K, V>> mapCreator, V ... values) {
- return mapValues(keyMapper, mapCreator, isEmpty(values) ? Collections.<V>emptyList() : Arrays.asList(values));
+ return mapValues(keyMapper, mapCreator, isEmpty(values) ? Collections.emptyList() : Arrays.asList(values));
}
/**
@@ -399,7 +399,7 @@ public final class GenericUtils {
*/
@SafeVarargs
public static <T> List<T> selectMatchingMembers(Predicate<? super T> acceptor, T ... values) {
- return selectMatchingMembers(acceptor, isEmpty(values) ? Collections.<T>emptyList() : Arrays.asList(values));
+ return selectMatchingMembers(acceptor, isEmpty(values) ? Collections.emptyList() : Arrays.asList(values));
}
/**
@@ -594,7 +594,7 @@ public final class GenericUtils {
* @see Collections#emptyIterator()
*/
public static <T> Iterator<T> iteratorOf(Iterator<T> iter) {
- return (iter == null) ? Collections.<T>emptyIterator() : iter;
+ return (iter == null) ? Collections.emptyIterator() : iter;
}
/**
@@ -608,7 +608,7 @@ public final class GenericUtils {
* @return The wrapping instance
*/
public static <T> Iterable<T> multiIterableSuppliers(final Iterable<? extends Supplier<? extends Iterable<? extends T>>> providers) {
- return (providers == null) ? Collections.<T>emptyList() : new Iterable<T>() {
+ return (providers == null) ? Collections.emptyList() : new Iterable<T>() {
@Override
public Iterator<T> iterator() {
return new Iterator<T>() {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
index 854b554..d34323c 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/SelectorUtils.java
@@ -149,14 +149,7 @@ public final class SelectorUtils {
if (strIdxStart > strIdxEnd) {
// String is exhausted
return true;
- } else if (patIdxStart > patIdxEnd) {
- // String not exhausted, but pattern is. Failure.
- return false;
- } else {
- // pattern now holds ** while string is not exhausted
- // this will generate false positives but we can live with that.
- return true;
- }
+ } else return patIdxStart <= patIdxEnd;
// CHECKSTYLE:ON
}
@@ -850,10 +843,7 @@ public final class SelectorUtils {
if (!target.exists()) {
return true;
}
- if ((src.lastModified() - granularity) > target.lastModified()) {
- return true;
- }
- return false;
+ return (src.lastModified() - granularity) > target.lastModified();
}
/**
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/AbstractBufferPublicKeyParser.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/AbstractBufferPublicKeyParser.java b/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/AbstractBufferPublicKeyParser.java
index 40a238b..247e7ef 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/AbstractBufferPublicKeyParser.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/buffer/keys/AbstractBufferPublicKeyParser.java
@@ -41,7 +41,7 @@ public abstract class AbstractBufferPublicKeyParser<PUB extends PublicKey> imple
private final Collection<String> supported;
protected AbstractBufferPublicKeyParser(Class<PUB> keyClass, String ... supported) {
- this(keyClass, GenericUtils.isEmpty(supported) ? Collections.<String>emptyList() : Arrays.asList(supported));
+ this(keyClass, GenericUtils.isEmpty(supported) ? Collections.emptyList() : Arrays.asList(supported));
}
protected AbstractBufferPublicKeyParser(Class<PUB> keyClass, Collection<String> supported) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/FuturesCloseable.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/FuturesCloseable.java b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/FuturesCloseable.java
index 265e740..3b6188f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/FuturesCloseable.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/FuturesCloseable.java
@@ -36,7 +36,7 @@ public class FuturesCloseable<T extends SshFuture> extends SimpleCloseable {
public FuturesCloseable(Object lock, Iterable<? extends SshFuture<T>> futures) {
super(lock);
- this.futures = (futures == null) ? Collections.<SshFuture<T>>emptyList() : futures;
+ this.futures = (futures == null) ? Collections.emptyList() : futures;
}
@Override
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/ParallelCloseable.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/ParallelCloseable.java b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/ParallelCloseable.java
index e611206..a009ed8 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/ParallelCloseable.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/ParallelCloseable.java
@@ -37,7 +37,7 @@ public class ParallelCloseable extends SimpleCloseable {
public ParallelCloseable(Object lock, Iterable<? extends Closeable> closeables) {
super(lock);
- this.closeables = (closeables == null) ? Collections.<Closeable>emptyList() : closeables;
+ this.closeables = (closeables == null) ? Collections.emptyList() : closeables;
}
@Override
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/SequentialCloseable.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/SequentialCloseable.java b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/SequentialCloseable.java
index 3a91831..f63ac91 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/SequentialCloseable.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/closeable/SequentialCloseable.java
@@ -37,7 +37,7 @@ public class SequentialCloseable extends SimpleCloseable {
public SequentialCloseable(Object lock, Iterable<? extends Closeable> closeables) {
super(lock);
- this.closeables = (closeables == null) ? Collections.<Closeable>emptyList() : closeables;
+ this.closeables = (closeables == null) ? Collections.emptyList() : closeables;
}
@Override
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java b/sshd-core/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java
index d51b7f6..ebca9f2 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java
@@ -144,11 +144,8 @@ public class ModifiableFileWatcher extends AbstractLoggingBean {
}
long timestamp = modifiedTime.toMillis();
- if (timestamp != lastModified.getAndSet(timestamp)) {
- return true;
- }
+ return timestamp != lastModified.getAndSet(timestamp);
- return false;
}
/**
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java b/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java
index 9a2778d..65252a0 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/net/SshdSocketAddress.java
@@ -225,11 +225,8 @@ public class SshdSocketAddress extends SocketAddress {
return false;
}
- if (isLoopback(addr)) {
- return false;
- }
+ return !isLoopback(addr);
- return true;
}
/**
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java b/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java
index e19c680..06b970e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/ServerAuthenticationManager.java
@@ -161,7 +161,7 @@ public interface ServerAuthenticationManager {
setUserAuthFactoriesNames(GenericUtils.split(names, ','));
}
default void setUserAuthFactoriesNames(String ... names) {
- setUserAuthFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.<String>emptyList() : Arrays.asList(names));
+ setUserAuthFactoriesNames(GenericUtils.isEmpty((Object[]) names) ? Collections.emptyList() : Arrays.asList(names));
}
default void setUserAuthFactoriesNames(Collection<String> names) {
BuiltinUserAuthFactories.ParseResult result = BuiltinUserAuthFactories.parseFactoriesList(names);
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java b/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java
index b60fabd..a9c836a 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/SshServer.java
@@ -601,7 +601,7 @@ public class SshServer extends AbstractFactoryManager implements ServerFactoryMa
return new ProcessShellFactory(GenericUtils.split(command, ' ')).create();
}
}).build());
- sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory()));
+ sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
sshd.start();
Thread.sleep(Long.MAX_VALUE);
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/StandardEnvironment.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/StandardEnvironment.java b/sshd-core/src/main/java/org/apache/sshd/server/StandardEnvironment.java
index 0b4adeb..22206c4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/StandardEnvironment.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/StandardEnvironment.java
@@ -140,7 +140,7 @@ public class StandardEnvironment extends AbstractLoggingBean implements Environm
synchronized (listeners) {
ls = listeners.get(signal);
if (ls == null) {
- ls = EventListenerUtils.<SignalListener>synchronizedListenersSet();
+ ls = EventListenerUtils.synchronizedListenersSet();
listeners.put(signal, ls);
}
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java
index 05c395b..4e69543 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/BuiltinUserAuthFactories.java
@@ -93,7 +93,7 @@ public enum BuiltinUserAuthFactories implements NamedFactory<UserAuthFactory> {
}
public static ParseResult parseFactoriesList(String... factories) {
- return parseFactoriesList(GenericUtils.isEmpty((Object[]) factories) ? Collections.<String>emptyList() : Arrays.asList(factories));
+ return parseFactoriesList(GenericUtils.isEmpty((Object[]) factories) ? Collections.emptyList() : Arrays.asList(factories));
}
public static ParseResult parseFactoriesList(Collection<String> factories) {
@@ -133,7 +133,7 @@ public enum BuiltinUserAuthFactories implements NamedFactory<UserAuthFactory> {
* @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
*/
public static class ParseResult extends NamedFactoriesListParseResult<UserAuth, UserAuthFactory> {
- public static final ParseResult EMPTY = new ParseResult(Collections.<UserAuthFactory>emptyList(), Collections.<String>emptyList());
+ public static final ParseResult EMPTY = new ParseResult(Collections.emptyList(), Collections.emptyList());
public ParseResult(List<UserAuthFactory> parsed, List<String> unsupported) {
super(parsed, unsupported);
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/UserAuthHostBased.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/UserAuthHostBased.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/UserAuthHostBased.java
index 2921437..2f501c3 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/UserAuthHostBased.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/hostbased/UserAuthHostBased.java
@@ -83,7 +83,7 @@ public class UserAuthHostBased extends AbstractUserAuth implements SignatureFact
Buffer buf = new ByteArrayBuffer(buffer.array(), keyOffset, keyLen, true);
PublicKey clientKey = buf.getRawPublicKey();
- List<X509Certificate> certs = Collections.<X509Certificate>emptyList();
+ List<X509Certificate> certs = Collections.emptyList();
if (buf.available() > 0) {
CertificateFactory cf = SecurityUtils.getCertificateFactory("X.509");
certs = new ArrayList<>();
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/auth/keyboard/UserAuthKeyboardInteractive.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/keyboard/UserAuthKeyboardInteractive.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/keyboard/UserAuthKeyboardInteractive.java
index 16f7e5d..9177966 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/keyboard/UserAuthKeyboardInteractive.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/keyboard/UserAuthKeyboardInteractive.java
@@ -97,7 +97,7 @@ public class UserAuthKeyboardInteractive extends AbstractUserAuth {
}
int num = buffer.getInt();
- List<String> responses = (num <= 0) ? Collections.<String>emptyList() : new ArrayList<String>(num);
+ List<String> responses = (num <= 0) ? Collections.emptyList() : new ArrayList<String>(num);
for (int index = 0; index < num; index++) {
String value = buffer.getString();
if (log.isTraceEnabled()) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/KeySetPublickeyAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/KeySetPublickeyAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/KeySetPublickeyAuthenticator.java
index 6cb844a..fcba948 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/KeySetPublickeyAuthenticator.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/auth/pubkey/KeySetPublickeyAuthenticator.java
@@ -34,7 +34,7 @@ public class KeySetPublickeyAuthenticator extends AbstractLoggingBean implements
private final Collection<? extends PublicKey> keySet;
public KeySetPublickeyAuthenticator(Collection<? extends PublicKey> keySet) {
- this.keySet = (keySet == null) ? Collections.<PublicKey>emptyList() : keySet;
+ this.keySet = (keySet == null) ? Collections.emptyList() : keySet;
}
public final Collection<? extends PublicKey> getKeySet() {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java b/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java
index 231c43b..835317e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java
@@ -48,7 +48,7 @@ public abstract class AbstractServerChannel extends AbstractChannel implements S
protected final AtomicBoolean exitStatusSent = new AtomicBoolean(false);
protected AbstractServerChannel() {
- this(Collections.<RequestHandler<Channel>>emptyList());
+ this(Collections.emptyList());
}
protected AbstractServerChannel(Collection<? extends RequestHandler<Channel>> handlers) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/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 d558d74..e655113 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
@@ -314,7 +314,7 @@ public class TcpipServerChannel extends AbstractServerChannel {
? ThreadUtils.newSingleThreadExecutor("TcpIpServerChannel-ConnectorCleanup[" + getSession() + "]")
: service;
// shutdown the temporary executor service if had to create it
- final boolean shutdown = (executors == service) ? isShutdownOnExit() : true;
+ final boolean shutdown = executors != service || isShutdownOnExit();
executors.submit(new Runnable() {
@SuppressWarnings("synthetic-access")
@Override
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/scp/ScpCommandFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/scp/ScpCommandFactory.java b/sshd-core/src/main/java/org/apache/sshd/server/scp/ScpCommandFactory.java
index 0961e1d..d53b666 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/scp/ScpCommandFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/scp/ScpCommandFactory.java
@@ -107,7 +107,7 @@ public class ScpCommandFactory implements ScpFileOpenerHolder, CommandFactory, C
private int sendBufferSize = ScpHelper.MIN_SEND_BUFFER_SIZE;
private int receiveBufferSize = ScpHelper.MIN_RECEIVE_BUFFER_SIZE;
private Collection<ScpTransferEventListener> listeners =
- EventListenerUtils.<ScpTransferEventListener>synchronizedListenersSet();
+ EventListenerUtils.synchronizedListenersSet();
private ScpTransferEventListener listenerProxy;
public ScpCommandFactory() {
@@ -258,7 +258,7 @@ public class ScpCommandFactory implements ScpFileOpenerHolder, CommandFactory, C
try {
ScpCommandFactory other = getClass().cast(super.clone());
// clone the listeners set as well
- other.listeners = EventListenerUtils.<ScpTransferEventListener>synchronizedListenersSet(this.listeners);
+ other.listeners = EventListenerUtils.synchronizedListenersSet(this.listeners);
other.listenerProxy = EventListenerUtils.proxyWrapper(ScpTransferEventListener.class, getClass().getClassLoader(), other.listeners);
return other;
} catch (CloneNotSupportedException e) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java b/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
index 189dae1..0cee65f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
@@ -113,7 +113,7 @@ public class InvertedShellWrapper extends AbstractLoggingBean implements Command
this.executor = (executor == null) ? ThreadUtils.newSingleThreadExecutor("shell[0x" + Integer.toHexString(shell.hashCode()) + "]") : executor;
ValidateUtils.checkTrue(bufferSize > Byte.SIZE, "Copy buffer size too small: %d", bufferSize);
this.bufferSize = bufferSize;
- this.shutdownExecutor = (executor == null) ? true : shutdownExecutor;
+ this.shutdownExecutor = (executor == null) || shutdownExecutor;
}
@Override
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShell.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShell.java b/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShell.java
index 755f390..a74de9b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShell.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShell.java
@@ -57,7 +57,7 @@ public class ProcessShell extends AbstractLoggingBean implements InvertedShell,
* create the full command to be executed by the shell
*/
public ProcessShell(String ... command) {
- this(GenericUtils.isEmpty(command) ? Collections.<String>emptyList() : Arrays.asList(command));
+ this(GenericUtils.isEmpty(command) ? Collections.emptyList() : Arrays.asList(command));
}
public ProcessShell(Collection<String> command) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java b/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java
index cfadb50..44b3caf 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/shell/ProcessShellFactory.java
@@ -38,11 +38,11 @@ public class ProcessShellFactory extends AbstractLoggingBean implements Factory<
private List<String> command;
public ProcessShellFactory() {
- this(Collections.<String>emptyList());
+ this(Collections.emptyList());
}
public ProcessShellFactory(String ... command) {
- this(GenericUtils.isEmpty(command) ? Collections.<String>emptyList() : Arrays.asList(command));
+ this(GenericUtils.isEmpty(command) ? Collections.emptyList() : Arrays.asList(command));
}
public ProcessShellFactory(List<String> command) {
@@ -54,7 +54,7 @@ public class ProcessShellFactory extends AbstractLoggingBean implements Factory<
}
public void setCommand(String ... command) {
- setCommand(GenericUtils.isEmpty(command) ? Collections.<String>emptyList() : Arrays.asList(command));
+ setCommand(GenericUtils.isEmpty(command) ? Collections.emptyList() : Arrays.asList(command));
}
public void setCommand(List<String> command) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/AbstractSftpEventListenerManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/AbstractSftpEventListenerManager.java b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/AbstractSftpEventListenerManager.java
index aa2c01c..91bbaf1 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/AbstractSftpEventListenerManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/subsystem/sftp/AbstractSftpEventListenerManager.java
@@ -29,7 +29,7 @@ import org.apache.sshd.common.util.ValidateUtils;
*/
public abstract class AbstractSftpEventListenerManager implements SftpEventListenerManager {
private final Collection<SftpEventListener> sftpEventListeners =
- EventListenerUtils.<SftpEventListener>synchronizedListenersSet();
+ EventListenerUtils.synchronizedListenersSet();
private final SftpEventListener sftpEventListenerProxy;
protected AbstractSftpEventListenerManager() {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/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 4aa4020..71d4379 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
@@ -303,7 +303,7 @@ public class SftpSubsystem
private ServerSession serverSession;
private final AtomicBoolean closed = new AtomicBoolean(false);
private final Collection<SftpEventListener> sftpEventListeners =
- EventListenerUtils.<SftpEventListener>synchronizedListenersSet();
+ EventListenerUtils.synchronizedListenersSet();
private final SftpEventListener sftpEventListenerProxy;
/**
@@ -1502,8 +1502,8 @@ public class SftpSubsystem
doCopyFile(id, srcFile, dstFile,
overwriteDestination
- ? Collections.<CopyOption>singletonList(StandardCopyOption.REPLACE_EXISTING)
- : Collections.<CopyOption>emptyList());
+ ? Collections.singletonList(StandardCopyOption.REPLACE_EXISTING)
+ : Collections.emptyList());
}
protected void doCopyFile(int id, String srcFile, String dstFile, Collection<CopyOption> opts) throws IOException {
@@ -1549,7 +1549,7 @@ public class SftpSubsystem
path = ".";
}
- Map<String, ?> attrs = Collections.<String, Object>emptyMap();
+ Map<String, ?> attrs = Collections.emptyMap();
Pair<Path, Boolean> result;
try {
LinkOption[] options = IoUtils.getLinkOptions(false);
@@ -2298,7 +2298,7 @@ public class SftpSubsystem
Map<String, OptionalFeature> extensions = getSupportedClientExtensions();
int numExtensions = GenericUtils.size(extensions);
- List<String> extras = (numExtensions <= 0) ? Collections.<String>emptyList() : new ArrayList<>(numExtensions);
+ List<String> extras = (numExtensions <= 0) ? Collections.emptyList() : new ArrayList<>(numExtensions);
if (numExtensions > 0) {
for (Map.Entry<String, OptionalFeature> ee : extensions.entrySet()) {
String name = ee.getKey();
@@ -2637,7 +2637,7 @@ public class SftpSubsystem
* The server will respond with a SSH_FXP_NAME packet containing only
* one name and a dummy attributes value.
*/
- Map<String, Object> attrs = Collections.<String, Object>emptyMap();
+ Map<String, Object> attrs = Collections.emptyMap();
if (version == SftpConstants.SFTP_V3) {
buffer.putString(SftpHelper.getLongName(normalizedPath, attrs));
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/LoadTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/LoadTest.java b/sshd-core/src/test/java/org/apache/sshd/LoadTest.java
index d27e6c9..2e5566f 100644
--- a/sshd-core/src/test/java/org/apache/sshd/LoadTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/LoadTest.java
@@ -35,11 +35,9 @@ import org.apache.sshd.client.channel.ClientChannel;
import org.apache.sshd.client.channel.ClientChannelEvent;
import org.apache.sshd.client.session.ClientSession;
import org.apache.sshd.common.FactoryManager;
-import org.apache.sshd.common.NamedFactory;
import org.apache.sshd.common.PropertyResolverUtils;
import org.apache.sshd.common.channel.Channel;
import org.apache.sshd.common.cipher.BuiltinCiphers;
-import org.apache.sshd.common.cipher.Cipher;
import org.apache.sshd.common.kex.BuiltinDHFactories;
import org.apache.sshd.server.SshServer;
import org.apache.sshd.util.test.BaseTestSupport;
@@ -127,7 +125,7 @@ public class LoadTest extends BaseTestSupport {
PropertyResolverUtils.updateProperty(client, FactoryManager.WINDOW_SIZE, 1024 * 8);
client.setKeyExchangeFactories(Arrays.asList(
ClientBuilder.DH2KEX.transform(BuiltinDHFactories.dhg1)));
- client.setCipherFactories(Arrays.<NamedFactory<Cipher>>asList(BuiltinCiphers.blowfishcbc));
+ client.setCipherFactories(Arrays.asList(BuiltinCiphers.blowfishcbc));
client.start();
try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
session.addPasswordIdentity(getCurrentTestName());
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java b/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
index 28d5436..aaab336 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java
@@ -48,7 +48,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
-import org.apache.sshd.client.auth.UserAuth;
import org.apache.sshd.client.auth.keyboard.UserAuthKeyboardInteractive;
import org.apache.sshd.client.auth.keyboard.UserAuthKeyboardInteractiveFactory;
import org.apache.sshd.client.auth.keyboard.UserInteraction;
@@ -67,14 +66,12 @@ import org.apache.sshd.client.subsystem.SubsystemClient;
import org.apache.sshd.client.subsystem.sftp.SftpClient;
import org.apache.sshd.common.Factory;
import org.apache.sshd.common.FactoryManager;
-import org.apache.sshd.common.NamedFactory;
import org.apache.sshd.common.NamedResource;
import org.apache.sshd.common.PropertyResolverUtils;
import org.apache.sshd.common.RuntimeSshException;
import org.apache.sshd.common.Service;
import org.apache.sshd.common.SshConstants;
import org.apache.sshd.common.SshException;
-import org.apache.sshd.common.channel.AbstractChannel;
import org.apache.sshd.common.channel.Channel;
import org.apache.sshd.common.channel.ChannelListener;
import org.apache.sshd.common.channel.ChannelListenerManager;
@@ -196,7 +193,7 @@ public class ClientTest extends BaseTestSupport {
},
ServerConnectionServiceFactory.INSTANCE
));
- sshd.setChannelFactories(Arrays.<NamedFactory<Channel>>asList(
+ sshd.setChannelFactories(Arrays.asList(
new ChannelSessionFactory() {
@Override
public Channel create() {
@@ -444,7 +441,7 @@ public class ClientTest extends BaseTestSupport {
assertSame("Mismatched closed channel instances", channel, channelHolder.getAndSet(null));
}
});
- sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory()));
+ sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
client.start();
@@ -958,7 +955,7 @@ public class ClientTest extends BaseTestSupport {
public void testPublicKeyAuth() throws Exception {
sshd.setPasswordAuthenticator(RejectAllPasswordAuthenticator.INSTANCE);
sshd.setKeyboardInteractiveAuthenticator(KeyboardInteractiveAuthenticator.NONE);
- client.setUserAuthFactories(Arrays.<NamedFactory<UserAuth>>asList(UserAuthPublicKeyFactory.INSTANCE));
+ client.setUserAuthFactories(Arrays.asList(UserAuthPublicKeyFactory.INSTANCE));
client.start();
try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -983,7 +980,7 @@ public class ClientTest extends BaseTestSupport {
return key.equals(pair.getPublic());
}
});
- client.setUserAuthFactories(Arrays.<NamedFactory<UserAuth>>asList(UserAuthPublicKeyFactory.INSTANCE));
+ client.setUserAuthFactories(Arrays.asList(UserAuthPublicKeyFactory.INSTANCE));
client.start();
try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -999,7 +996,7 @@ public class ClientTest extends BaseTestSupport {
@Test
public void testPasswordAuthNew() throws Exception {
- client.setUserAuthFactories(Arrays.<NamedFactory<UserAuth>>asList(UserAuthPasswordFactory.INSTANCE));
+ client.setUserAuthFactories(Arrays.asList(UserAuthPasswordFactory.INSTANCE));
client.start();
try (ClientSession session = createTestClientSession()) {
@@ -1012,7 +1009,7 @@ public class ClientTest extends BaseTestSupport {
@Test
public void testPasswordAuthNewWithFailureOnFirstIdentity() throws Exception {
- client.setUserAuthFactories(Arrays.<NamedFactory<UserAuth>>asList(UserAuthPasswordFactory.INSTANCE));
+ client.setUserAuthFactories(Arrays.asList(UserAuthPasswordFactory.INSTANCE));
client.start();
try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -1028,7 +1025,7 @@ public class ClientTest extends BaseTestSupport {
@Test
public void testKeyboardInteractiveAuthNew() throws Exception {
- client.setUserAuthFactories(Arrays.<NamedFactory<UserAuth>>asList(UserAuthKeyboardInteractiveFactory.INSTANCE));
+ client.setUserAuthFactories(Arrays.asList(UserAuthKeyboardInteractiveFactory.INSTANCE));
client.start();
try (ClientSession session = createTestClientSession()) {
@@ -1041,7 +1038,7 @@ public class ClientTest extends BaseTestSupport {
@Test
public void testKeyboardInteractiveAuthNewWithFailureOnFirstIdentity() throws Exception {
- client.setUserAuthFactories(Arrays.<NamedFactory<UserAuth>>asList(UserAuthKeyboardInteractiveFactory.INSTANCE));
+ client.setUserAuthFactories(Arrays.asList(UserAuthKeyboardInteractiveFactory.INSTANCE));
client.start();
try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -1058,7 +1055,7 @@ public class ClientTest extends BaseTestSupport {
@Test // see SSHD-504
public void testDefaultKeyboardInteractivePasswordPromptLocationIndependence() throws Exception {
final Collection<String> mismatchedPrompts = new LinkedList<>();
- client.setUserAuthFactories(Arrays.<NamedFactory<UserAuth>>asList(new UserAuthKeyboardInteractiveFactory() {
+ client.setUserAuthFactories(Arrays.asList(new UserAuthKeyboardInteractiveFactory() {
@Override
public UserAuthKeyboardInteractive create() {
return new UserAuthKeyboardInteractive() {
@@ -1089,7 +1086,7 @@ public class ClientTest extends BaseTestSupport {
}
};
final List<Transformer<String, String>> xformers =
- Collections.unmodifiableList(Arrays.<Transformer<String, String>>asList(
+ Collections.unmodifiableList(Arrays.asList(
new Transformer<String, String>() { // prefixed
@Override
public String transform(String input) {
@@ -1153,7 +1150,7 @@ public class ClientTest extends BaseTestSupport {
@Test
public void testDefaultKeyboardInteractiveWithFailures() throws Exception {
- client.setUserAuthFactories(Collections.<NamedFactory<UserAuth>>singletonList(UserAuthKeyboardInteractiveFactory.INSTANCE));
+ client.setUserAuthFactories(Collections.singletonList(UserAuthKeyboardInteractiveFactory.INSTANCE));
final AtomicInteger count = new AtomicInteger();
final AtomicReference<ClientSession> interactionSessionHolder = new AtomicReference<>(null);
@@ -1220,7 +1217,7 @@ public class ClientTest extends BaseTestSupport {
final int maxPrompts = 3;
PropertyResolverUtils.updateProperty(client, ClientAuthenticationManager.PASSWORD_PROMPTS, maxPrompts);
- client.setUserAuthFactories(Collections.<NamedFactory<UserAuth>>singletonList(UserAuthKeyboardInteractiveFactory.INSTANCE));
+ client.setUserAuthFactories(Collections.singletonList(UserAuthKeyboardInteractiveFactory.INSTANCE));
client.start();
try (final ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -1271,7 +1268,7 @@ public class ClientTest extends BaseTestSupport {
final AtomicInteger count = new AtomicInteger();
final int maxPrompts = 3;
PropertyResolverUtils.updateProperty(client, ClientAuthenticationManager.PASSWORD_PROMPTS, maxPrompts);
- client.setUserAuthFactories(Collections.<NamedFactory<UserAuth>>singletonList(UserAuthKeyboardInteractiveFactory.INSTANCE));
+ client.setUserAuthFactories(Collections.singletonList(UserAuthKeyboardInteractiveFactory.INSTANCE));
client.start();
try (final ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -1396,7 +1393,7 @@ public class ClientTest extends BaseTestSupport {
Set<Integer> ids = new HashSet<>(channels.size());
for (ClientChannel c : channels) {
- int id = ((AbstractChannel) c).getId();
+ int id = c.getId();
assertTrue("Channel ID repeated: " + id, ids.add(Integer.valueOf(id)));
}
} finally {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolverTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolverTest.java b/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolverTest.java
index 1a7e319..4b86ad2 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolverTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolverTest.java
@@ -59,7 +59,7 @@ public class ConfigFileHostEntryResolverTest extends BaseTestSupport {
HostConfigEntry expected = new HostConfigEntry(getCurrentTestName(), getCurrentTestName(), 7365, getCurrentTestName());
testConfigFileReload("Non-existing", path, reloadCount, null, resolver, expected, null);
- testConfigFileReload("Empty", path, reloadCount, Collections.<HostConfigEntry>emptyList(), resolver, expected, null);
+ testConfigFileReload("Empty", path, reloadCount, Collections.emptyList(), resolver, expected, null);
testConfigFileReload("Global", path, reloadCount,
Collections.singletonList(new HostConfigEntry(HostPatternsHolder.ALL_HOSTS_PATTERN, expected.getHost(), expected.getPort(), expected.getUsername())),
resolver, expected, expected);
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSftpClientTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSftpClientTest.java b/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSftpClientTest.java
index bde1cc2..6e037b0 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSftpClientTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/simple/SimpleSftpClientTest.java
@@ -27,13 +27,11 @@ import java.util.Collections;
import java.util.EnumSet;
import org.apache.sshd.client.subsystem.sftp.SftpClient;
-import org.apache.sshd.common.NamedFactory;
import org.apache.sshd.common.file.FileSystemFactory;
import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory;
import org.apache.sshd.common.session.Session;
import org.apache.sshd.common.subsystem.sftp.SftpConstants;
import org.apache.sshd.common.util.io.IoUtils;
-import org.apache.sshd.server.Command;
import org.apache.sshd.server.scp.ScpCommandFactory;
import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory;
import org.apache.sshd.util.test.Utils;
@@ -59,7 +57,7 @@ public class SimpleSftpClientTest extends BaseSimpleClientTestSupport {
@Override
public void setUp() throws Exception {
super.setUp();
- sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory()));
+ sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
sshd.setCommandFactory(new ScpCommandFactory());
sshd.setFileSystemFactory(fileSystemFactory);
client.start();
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClientTestSupport.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClientTestSupport.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClientTestSupport.java
index f2ef1bd..1fb68e0 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClientTestSupport.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/AbstractSftpClientTestSupport.java
@@ -25,10 +25,8 @@ import java.util.Collections;
import org.apache.sshd.client.SshClient;
import org.apache.sshd.client.subsystem.sftp.extensions.SftpClientExtension;
-import org.apache.sshd.common.NamedFactory;
import org.apache.sshd.common.file.FileSystemFactory;
import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory;
-import org.apache.sshd.server.Command;
import org.apache.sshd.server.SshServer;
import org.apache.sshd.server.scp.ScpCommandFactory;
import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory;
@@ -58,7 +56,7 @@ public abstract class AbstractSftpClientTestSupport extends BaseTestSupport {
public static void setupClientAndServer() throws Exception {
JSchLogger.init();
sshd = Utils.setupTestServer(AbstractSftpClientTestSupport.class);
- sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory()));
+ sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
sshd.setCommandFactory(new ScpCommandFactory());
sshd.start();
port = sshd.getPort();
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemTest.java
index b673821..cf661ef 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpFileSystemTest.java
@@ -54,7 +54,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.sshd.client.SshClient;
import org.apache.sshd.client.session.ClientSession;
-import org.apache.sshd.common.NamedFactory;
import org.apache.sshd.common.PropertyResolverUtils;
import org.apache.sshd.common.file.FileSystemFactory;
import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory;
@@ -63,7 +62,6 @@ import org.apache.sshd.common.subsystem.sftp.SftpConstants;
import org.apache.sshd.common.util.GenericUtils;
import org.apache.sshd.common.util.OsUtils;
import org.apache.sshd.common.util.io.IoUtils;
-import org.apache.sshd.server.Command;
import org.apache.sshd.server.SshServer;
import org.apache.sshd.server.scp.ScpCommandFactory;
import org.apache.sshd.server.subsystem.sftp.SftpSubsystem;
@@ -93,7 +91,7 @@ public class SftpFileSystemTest extends BaseTestSupport {
@BeforeClass
public static void setupServerInstance() throws Exception {
sshd = Utils.setupTestServer(SftpFileSystemTest.class);
- sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory()));
+ sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
sshd.setCommandFactory(new ScpCommandFactory());
sshd.start();
port = sshd.getPort();
@@ -140,7 +138,7 @@ public class SftpFileSystemTest extends BaseTestSupport {
int expectedVersion = (SftpSubsystem.LOWER_SFTP_IMPL + SftpSubsystem.HIGHER_SFTP_IMPL) / 2;
params.put(SftpFileSystemProvider.VERSION_PARAM, Integer.valueOf(expectedVersion));
- try (SftpFileSystem fs = (SftpFileSystem) FileSystems.newFileSystem(createDefaultFileSystemURI(params), Collections.<String, Object>emptyMap())) {
+ try (SftpFileSystem fs = (SftpFileSystem) FileSystems.newFileSystem(createDefaultFileSystemURI(params), Collections.emptyMap())) {
try (SftpClient sftpClient = fs.getClient()) {
assertEquals("Mismatched negotiated version", expectedVersion, sftpClient.getVersion());
@@ -223,7 +221,7 @@ public class SftpFileSystemTest extends BaseTestSupport {
@Test
public void testFileStore() throws IOException {
- try (FileSystem fs = FileSystems.newFileSystem(createDefaultFileSystemURI(), Collections.<String, Object>emptyMap())) {
+ try (FileSystem fs = FileSystems.newFileSystem(createDefaultFileSystemURI(), Collections.emptyMap())) {
Iterable<FileStore> iter = fs.getFileStores();
assertTrue("Not a list", iter instanceof List<?>);
@@ -253,7 +251,7 @@ public class SftpFileSystemTest extends BaseTestSupport {
Collection<SftpFileSystem> fsList = new LinkedList<>();
try {
Collection<String> idSet = new HashSet<>();
- Map<String, Object> empty = Collections.<String, Object>emptyMap();
+ Map<String, Object> empty = Collections.emptyMap();
for (int index = 0; index < 4; index++) {
String credentials = getCurrentTestName() + "-user-" + index;
SftpFileSystem expected = provider.newFileSystem(createFileSystemURI(credentials, empty), empty);
@@ -464,7 +462,7 @@ public class SftpFileSystemTest extends BaseTestSupport {
}
private URI createDefaultFileSystemURI() {
- return createDefaultFileSystemURI(Collections.<String, Object>emptyMap());
+ return createDefaultFileSystemURI(Collections.emptyMap());
}
private URI createDefaultFileSystemURI(Map<String, ?> params) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
index 0da39a9..ad29b74 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/SftpVersionsTest.java
@@ -270,7 +270,7 @@ public class SftpVersionsTest extends AbstractSftpClientTestSupport {
int numInvoked = 0;
List<NamedFactory<Command>> factories = sshd.getSubsystemFactories();
- sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(factory));
+ sshd.setSubsystemFactories(Collections.singletonList(factory));
try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
session.addPasswordIdentity(getCurrentTestName());
session.auth().verify(5L, TimeUnit.SECONDS);
@@ -390,7 +390,7 @@ public class SftpVersionsTest extends AbstractSftpClientTestSupport {
int numInvoked = 0;
List<NamedFactory<Command>> factories = sshd.getSubsystemFactories();
- sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(factory));
+ sshd.setSubsystemFactories(Collections.singletonList(factory));
try (ClientSession session = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
session.addPasswordIdentity(getCurrentTestName());
session.auth().verify(5L, TimeUnit.SECONDS);
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImplTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImplTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImplTest.java
index e2ba00d..16f49ba 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImplTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImplTest.java
@@ -60,7 +60,7 @@ import org.junit.runners.Parameterized.Parameters;
public class CopyDataExtensionImplTest extends AbstractSftpClientTestSupport {
private static final List<Object[]> PARAMETERS =
Collections.unmodifiableList(
- Arrays.<Object[]>asList(
+ Arrays.asList(
new Object[]{
Integer.valueOf(IoUtils.DEFAULT_COPY_SIZE),
Integer.valueOf(0),
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImplTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImplTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImplTest.java
index e3f0c7f..9fb6775 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImplTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImplTest.java
@@ -68,7 +68,7 @@ public class SpaceAvailableExtensionImplTest extends AbstractSftpClientTestSuppo
final SpaceAvailableExtensionInfo expected = new SpaceAvailableExtensionInfo(store);
List<NamedFactory<Command>> factories = sshd.getSubsystemFactories();
- sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory() {
+ sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory() {
@Override
public Command create() {
return new SftpSubsystem(getExecutorService(), isShutdownOnExit(), getUnsupportedAttributePolicy()) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHExtensionsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHExtensionsTest.java b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHExtensionsTest.java
index 375c846..8557375 100644
--- a/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHExtensionsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHExtensionsTest.java
@@ -41,7 +41,6 @@ import org.apache.sshd.client.subsystem.sftp.extensions.openssh.OpenSSHFsyncExte
import org.apache.sshd.client.subsystem.sftp.extensions.openssh.OpenSSHStatExtensionInfo;
import org.apache.sshd.client.subsystem.sftp.extensions.openssh.OpenSSHStatHandleExtension;
import org.apache.sshd.client.subsystem.sftp.extensions.openssh.OpenSSHStatPathExtension;
-import org.apache.sshd.common.NamedFactory;
import org.apache.sshd.common.subsystem.sftp.SftpConstants;
import org.apache.sshd.common.subsystem.sftp.extensions.openssh.AbstractOpenSSHExtensionParser.OpenSSHExtension;
import org.apache.sshd.common.subsystem.sftp.extensions.openssh.FstatVfsExtensionParser;
@@ -122,7 +121,7 @@ public class OpenSSHExtensionsTest extends AbstractSftpClientTestSupport {
expected.f_fsid = 1L;
expected.f_namemax = 256;
- sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory() {
+ sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory() {
@Override
public Command create() {
return new SftpSubsystem(getExecutorService(), isShutdownOnExit(), getUnsupportedAttributePolicy()) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java b/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
index 7fefdb3..1393de9 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/auth/AuthenticationTest.java
@@ -36,7 +36,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.sshd.client.SshClient;
-import org.apache.sshd.client.auth.UserAuth;
import org.apache.sshd.client.auth.hostbased.HostKeyIdentityProvider;
import org.apache.sshd.client.auth.keyboard.UserInteraction;
import org.apache.sshd.client.auth.password.PasswordIdentityProvider;
@@ -172,7 +171,7 @@ public class AuthenticationTest extends BaseTestSupport {
});
final AtomicInteger changesCount = new AtomicInteger(0);
- sshd.setUserAuthFactories(Collections.<NamedFactory<org.apache.sshd.server.auth.UserAuth>>singletonList(
+ sshd.setUserAuthFactories(Collections.singletonList(
new org.apache.sshd.server.auth.password.UserAuthPasswordFactory() {
@Override
public org.apache.sshd.server.auth.password.UserAuthPassword create() {
@@ -217,7 +216,7 @@ public class AuthenticationTest extends BaseTestSupport {
});
final AtomicInteger sentCount = new AtomicInteger(0);
- client.setUserAuthFactories(Collections.<NamedFactory<org.apache.sshd.client.auth.UserAuth>>singletonList(
+ client.setUserAuthFactories(Collections.singletonList(
new org.apache.sshd.client.auth.password.UserAuthPasswordFactory() {
@Override
public org.apache.sshd.client.auth.password.UserAuthPassword create() {
@@ -611,7 +610,7 @@ public class AuthenticationTest extends BaseTestSupport {
try (SshClient client = setupTestClient()) {
// force server to use only the RSA key
final NamedFactory<Signature> kexSignature = BuiltinSignatures.rsa;
- client.setSignatureFactories(Collections.<NamedFactory<Signature>>singletonList(kexSignature));
+ client.setSignatureFactories(Collections.singletonList(kexSignature));
client.setServerKeyVerifier(new ServerKeyVerifier() {
@Override
public boolean verifyServerKey(ClientSession sshClientSession, SocketAddress remoteAddress, PublicKey serverKey) {
@@ -627,8 +626,8 @@ public class AuthenticationTest extends BaseTestSupport {
// allow only EC keys for public key authentication
org.apache.sshd.client.auth.pubkey.UserAuthPublicKeyFactory factory = new org.apache.sshd.client.auth.pubkey.UserAuthPublicKeyFactory();
- factory.setSignatureFactories(Arrays.<NamedFactory<Signature>>asList(BuiltinSignatures.nistp256, BuiltinSignatures.nistp384, BuiltinSignatures.nistp521));
- client.setUserAuthFactories(Collections.<NamedFactory<UserAuth>>singletonList(factory));
+ factory.setSignatureFactories(Arrays.asList(BuiltinSignatures.nistp256, BuiltinSignatures.nistp384, BuiltinSignatures.nistp521));
+ client.setUserAuthFactories(Collections.singletonList(factory));
client.start();
try (ClientSession s = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
@@ -643,7 +642,7 @@ public class AuthenticationTest extends BaseTestSupport {
@Test // see SSHD-624
public void testMismatchedUserAuthPkOkData() throws Exception {
final AtomicInteger challengeCounter = new AtomicInteger(0);
- sshd.setUserAuthFactories(Collections.<NamedFactory<org.apache.sshd.server.auth.UserAuth>>singletonList(
+ sshd.setUserAuthFactories(Collections.singletonList(
new org.apache.sshd.server.auth.pubkey.UserAuthPublicKeyFactory() {
@Override
public org.apache.sshd.server.auth.pubkey.UserAuthPublicKey create() {
@@ -717,7 +716,7 @@ public class AuthenticationTest extends BaseTestSupport {
sshd.setKeyboardInteractiveAuthenticator(KeyboardInteractiveAuthenticator.NONE);
sshd.setPublickeyAuthenticator(RejectAllPublickeyAuthenticator.INSTANCE);
sshd.setUserAuthFactories(
- Collections.<NamedFactory<org.apache.sshd.server.auth.UserAuth>>singletonList(
+ Collections.singletonList(
org.apache.sshd.server.auth.hostbased.UserAuthHostBasedFactory.INSTANCE));
try (SshClient client = setupTestClient()) {
@@ -727,7 +726,7 @@ public class AuthenticationTest extends BaseTestSupport {
factory.setClientUsername(hostClienUser);
factory.setClientHostKeys(HostKeyIdentityProvider.Utils.wrap(hostClientKey));
- client.setUserAuthFactories(Collections.<NamedFactory<org.apache.sshd.client.auth.UserAuth>>singletonList(factory));
+ client.setUserAuthFactories(Collections.singletonList(factory));
client.start();
try (ClientSession s = client.connect(getCurrentTestName(), TEST_LOCALHOST, port).verify(7L, TimeUnit.SECONDS).getSession()) {
s.auth().verify(11L, TimeUnit.SECONDS);
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedInputStreamTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedInputStreamTest.java b/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedInputStreamTest.java
index 6c6cf0b..5a0f953 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedInputStreamTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/channel/ChannelPipedInputStreamTest.java
@@ -69,7 +69,7 @@ public class ChannelPipedInputStreamTest extends BaseTestSupport {
private static ChannelPipedInputStream createTestStream() {
AbstractChannel channel = new BogusChannel();
Window window = new Window(channel, null, true, true);
- window.init(PropertyResolverUtils.toPropertyResolver(Collections.<String, Object>emptyMap()));
+ window.init(PropertyResolverUtils.toPropertyResolver(Collections.emptyMap()));
return new ChannelPipedInputStream(channel, window);
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java b/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java
index 3d21f80..e19c0bb 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/channel/WindowTest.java
@@ -36,7 +36,6 @@ import org.apache.sshd.client.channel.ClientChannel;
import org.apache.sshd.client.future.OpenFuture;
import org.apache.sshd.client.session.ClientSession;
import org.apache.sshd.common.FactoryManager;
-import org.apache.sshd.common.NamedFactory;
import org.apache.sshd.common.PropertyResolverUtils;
import org.apache.sshd.common.RuntimeSshException;
import org.apache.sshd.common.Service;
@@ -106,7 +105,7 @@ public class WindowTest extends BaseTestSupport {
},
ServerConnectionServiceFactory.INSTANCE
));
- sshd.setChannelFactories(Arrays.<NamedFactory<Channel>>asList(
+ sshd.setChannelFactories(Arrays.asList(
new ChannelSessionFactory() {
@Override
public Channel create() {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/cipher/BuiltinCiphersTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/cipher/BuiltinCiphersTest.java b/sshd-core/src/test/java/org/apache/sshd/common/cipher/BuiltinCiphersTest.java
index a6926b8..7d74d81 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/cipher/BuiltinCiphersTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/cipher/BuiltinCiphersTest.java
@@ -211,7 +211,7 @@ public class BuiltinCiphersTest extends BaseTestSupport {
for (int bIndex = 0, uIndex = 0; (bIndex < builtin.size()) || (uIndex < unknown.size());) {
boolean useBuiltin = false;
if (bIndex < builtin.size()) {
- useBuiltin = (uIndex < unknown.size()) ? rnd.nextBoolean() : true;
+ useBuiltin = uIndex >= unknown.size() || rnd.nextBoolean();
}
if (useBuiltin) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/cipher/CipherTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/cipher/CipherTest.java b/sshd-core/src/test/java/org/apache/sshd/common/cipher/CipherTest.java
index 36883cc..c5a76a3 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/cipher/CipherTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/cipher/CipherTest.java
@@ -129,7 +129,7 @@ public class CipherTest extends BaseTestSupport {
@Test
public void testBuiltinCipherSession() throws Exception {
Assume.assumeTrue("No internal support for " + builtInCipher.getName(), builtInCipher.isSupported() && checkCipher(jschCipher.getName()));
- sshd.setCipherFactories(Collections.<NamedFactory<org.apache.sshd.common.cipher.Cipher>>singletonList(builtInCipher));
+ sshd.setCipherFactories(Collections.singletonList(builtInCipher));
runJschTest(port);
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/compression/BuiltinCompressionsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/compression/BuiltinCompressionsTest.java b/sshd-core/src/test/java/org/apache/sshd/common/compression/BuiltinCompressionsTest.java
index a122518..a0a2828 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/compression/BuiltinCompressionsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/compression/BuiltinCompressionsTest.java
@@ -87,7 +87,7 @@ public class BuiltinCompressionsTest extends BaseTestSupport {
for (int bIndex = 0, uIndex = 0; (bIndex < builtin.size()) || (uIndex < unknown.size());) {
boolean useBuiltin = false;
if (bIndex < builtin.size()) {
- useBuiltin = (uIndex < unknown.size()) ? rnd.nextBoolean() : true;
+ useBuiltin = uIndex >= unknown.size() || rnd.nextBoolean();
}
if (useBuiltin) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java b/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java
index 59f2af9..b2dec83 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/compression/CompressionTest.java
@@ -29,7 +29,6 @@ import java.util.List;
import com.jcraft.jsch.JSch;
-import org.apache.sshd.common.NamedFactory;
import org.apache.sshd.common.channel.Channel;
import org.apache.sshd.common.kex.KexProposalOption;
import org.apache.sshd.common.mac.MacTest;
@@ -113,7 +112,7 @@ public class CompressionTest extends BaseTestSupport {
@Before
public void setUp() throws Exception {
- sshd.setCompressionFactories(Arrays.<NamedFactory<org.apache.sshd.common.compression.Compression>>asList(factory));
+ sshd.setCompressionFactories(Arrays.asList(factory));
sshd.addSessionListener(listener);
String name = factory.getName();
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java b/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java
index 32131c3..be95fcf 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java
@@ -67,7 +67,7 @@ public class RootedFileSystemProviderTest extends AssertableFile {
Utils.detectTargetFolder(RootedFileSystemProviderTest.class), "Failed to detect target folder").toPath();
rootSandbox = FileHelper.createTestSandbox(targetFolder.resolve(TEMP_SUBFOLDER_NAME));
fileSystem = (RootedFileSystem) new RootedFileSystemProvider().newFileSystem(rootSandbox,
- Collections.<String, Object> emptyMap());
+ Collections.emptyMap());
}
@Test
@@ -217,8 +217,8 @@ public class RootedFileSystemProviderTest extends AssertableFile {
RootedFileSystemProvider provider = new RootedFileSystemProvider();
Path tempFolder = assertHierarchyTargetFolderExists(getTempTargetFolder());
Path file = Files.createTempFile(tempFolder, getCurrentTestName(), ".txt");
- try (FileSystem fs = provider.newFileSystem(tempFolder, Collections.<String, Object>emptyMap());
- Channel channel = provider.newByteChannel(fs.getPath(file.getFileName().toString()), Collections.<OpenOption>emptySet())) {
+ try (FileSystem fs = provider.newFileSystem(tempFolder, Collections.emptyMap());
+ Channel channel = provider.newByteChannel(fs.getPath(file.getFileName().toString()), Collections.emptySet())) {
assertTrue("Channel not open", channel.isOpen());
}
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/file/util/BasePathTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/file/util/BasePathTest.java b/sshd-core/src/test/java/org/apache/sshd/common/file/util/BasePathTest.java
index 5d69f0a..ee98a22 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/file/util/BasePathTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/file/util/BasePathTest.java
@@ -388,7 +388,7 @@ public class BasePathTest extends BaseTestSupport {
private final FileSystem fileSystem;
private final String string;
private String root;
- private List<String> names = Collections.<String>emptyList();
+ private List<String> names = Collections.emptyList();
public PathTester(FileSystem fileSystem, String string) {
this.fileSystem = fileSystem;
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactoryTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactoryTest.java b/sshd-core/src/test/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactoryTest.java
index c9bf9e5..965c7d4 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactoryTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactoryTest.java
@@ -56,12 +56,12 @@ public class DefaultIoServiceFactoryFactoryTest extends BaseTestSupport {
@Test
public void testExecutorServiceInitialization() throws IOException {
ExecutorService service = Mockito.mock(ExecutorService.class);
- Mockito.when(service.shutdownNow()).thenReturn(Collections.<Runnable>emptyList());
+ Mockito.when(service.shutdownNow()).thenReturn(Collections.emptyList());
Mockito.when(service.isShutdown()).thenReturn(Boolean.TRUE);
Mockito.when(service.isTerminated()).thenReturn(Boolean.TRUE);
FactoryManager manager = Mockito.mock(FactoryManager.class);
- Mockito.when(manager.getProperties()).thenReturn(Collections.<String, Object>emptyMap());
+ Mockito.when(manager.getProperties()).thenReturn(Collections.emptyMap());
String propName = IoServiceFactoryFactory.class.getName();
for (BuiltinIoServiceFactoryFactories f : BuiltinIoServiceFactoryFactories.VALUES) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/kex/BuiltinDHFactoriesTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/kex/BuiltinDHFactoriesTest.java b/sshd-core/src/test/java/org/apache/sshd/common/kex/BuiltinDHFactoriesTest.java
index 8cfb1ee..74a7804 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/kex/BuiltinDHFactoriesTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/kex/BuiltinDHFactoriesTest.java
@@ -82,7 +82,7 @@ public class BuiltinDHFactoriesTest extends BaseTestSupport {
for (int bIndex = 0, uIndex = 0; (bIndex < builtin.size()) || (uIndex < unknown.size());) {
boolean useBuiltin = false;
if (bIndex < builtin.size()) {
- useBuiltin = (uIndex < unknown.size()) ? rnd.nextBoolean() : true;
+ useBuiltin = uIndex >= unknown.size() || rnd.nextBoolean();
}
if (useBuiltin) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/mac/BuiltinMacsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/mac/BuiltinMacsTest.java b/sshd-core/src/test/java/org/apache/sshd/common/mac/BuiltinMacsTest.java
index 10af615..7972b25 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/mac/BuiltinMacsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/mac/BuiltinMacsTest.java
@@ -82,7 +82,7 @@ public class BuiltinMacsTest extends BaseTestSupport {
for (int bIndex = 0, uIndex = 0; (bIndex < builtin.size()) || (uIndex < unknown.size());) {
boolean useBuiltin = false;
if (bIndex < builtin.size()) {
- useBuiltin = (uIndex < unknown.size()) ? rnd.nextBoolean() : true;
+ useBuiltin = uIndex >= unknown.size() || rnd.nextBoolean();
}
if (useBuiltin) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/mac/MacTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/mac/MacTest.java b/sshd-core/src/test/java/org/apache/sshd/common/mac/MacTest.java
index 20e5c69..86e74af 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/mac/MacTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/mac/MacTest.java
@@ -32,7 +32,6 @@ import java.util.concurrent.TimeUnit;
import com.jcraft.jsch.JSch;
-import org.apache.sshd.common.NamedFactory;
import org.apache.sshd.common.channel.Channel;
import org.apache.sshd.common.util.GenericUtils;
import org.apache.sshd.server.SshServer;
@@ -145,7 +144,7 @@ public class MacTest extends BaseTestSupport {
@Before
public void setUp() throws Exception {
- sshd.setMacFactories(Arrays.<NamedFactory<Mac>>asList(factory));
+ sshd.setMacFactories(Arrays.asList(factory));
}
@Test
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/mac/MacVectorsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/mac/MacVectorsTest.java b/sshd-core/src/test/java/org/apache/sshd/common/mac/MacVectorsTest.java
index da714c5..c8a8b24 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/mac/MacVectorsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/mac/MacVectorsTest.java
@@ -200,7 +200,7 @@ public class MacVectorsTest extends BaseTestSupport {
*/
// mark end
- new VectorTestData("", false, "", false, Collections.<Pair<String, String>>emptyList())))) {
+ new VectorTestData("", false, "", false, Collections.emptyList())))) {
for (Pair<String, String> tc : vector.getResults()) {
ret.add(new Object[]{vector, tc.getFirst(), tc.getSecond()});
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/signature/BuiltinSignaturesTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/signature/BuiltinSignaturesTest.java b/sshd-core/src/test/java/org/apache/sshd/common/signature/BuiltinSignaturesTest.java
index 604d76e..356846c 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/signature/BuiltinSignaturesTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/signature/BuiltinSignaturesTest.java
@@ -65,7 +65,7 @@ public class BuiltinSignaturesTest extends BaseTestSupport {
for (int bIndex = 0, uIndex = 0; (bIndex < builtin.size()) || (uIndex < unknown.size());) {
boolean useBuiltin = false;
if (bIndex < builtin.size()) {
- useBuiltin = (uIndex < unknown.size()) ? rnd.nextBoolean() : true;
+ useBuiltin = uIndex >= unknown.size() || rnd.nextBoolean();
}
if (useBuiltin) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/common/util/EventListenerUtilsTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/util/EventListenerUtilsTest.java b/sshd-core/src/test/java/org/apache/sshd/common/util/EventListenerUtilsTest.java
index 7b22fbe..4db0e0a 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/util/EventListenerUtilsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/util/EventListenerUtilsTest.java
@@ -91,7 +91,7 @@ public class EventListenerUtilsTest extends BaseTestSupport {
@Test
public void testSynchronizedListenersSetOnProxies() {
ProxyListener p1 = EventListenerUtils.proxyWrapper(ProxyListener.class, Collections.singletonList(new ProxyListenerImpl()));
- Set<ProxyListener> s = EventListenerUtils.<ProxyListener>synchronizedListenersSet();
+ Set<ProxyListener> s = EventListenerUtils.synchronizedListenersSet();
for (int index = 1; index <= Byte.SIZE; index++) {
boolean modified = s.add(p1);
assertEquals("Mismatched p1 modification indicator at attempt #" + index, index == 1, modified);
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthAgent.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthAgent.java b/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthAgent.java
index bffbe62..8907b2e 100644
--- a/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthAgent.java
+++ b/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthAgent.java
@@ -85,7 +85,7 @@ public class UserAuthAgent extends AbstractUserAuth {
} catch (IOException e) {
throw e;
} catch (Exception e) {
- throw (IOException) new IOException("Error performing public key authentication").initCause(e);
+ throw (IOException) new IOException("Error performing public key authentication", e);
}
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPublicKey.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPublicKey.java b/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPublicKey.java
index 1f9be26..6593c0a 100644
--- a/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPublicKey.java
+++ b/sshd-core/src/test/java/org/apache/sshd/deprecated/UserAuthPublicKey.java
@@ -89,7 +89,7 @@ public class UserAuthPublicKey extends AbstractUserAuth {
} catch (IOException e) {
throw e;
} catch (Exception e) {
- throw (IOException) new IOException("Error performing public key authentication").initCause(e);
+ throw (IOException) new IOException("Error performing public key authentication", e);
}
} else {
int cmd = buffer.getUByte();
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java b/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java
index 5fcaba2..56122c8 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/ServerSessionListenerTest.java
@@ -41,7 +41,6 @@ import org.apache.sshd.common.mac.Mac;
import org.apache.sshd.common.session.Session;
import org.apache.sshd.common.session.SessionListener;
import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.server.auth.UserAuth;
import org.apache.sshd.server.auth.keyboard.KeyboardInteractiveAuthenticator;
import org.apache.sshd.server.auth.password.PasswordAuthenticator;
import org.apache.sshd.server.auth.password.PasswordChangeRequiredException;
@@ -214,7 +213,7 @@ public class ServerSessionListenerTest extends BaseTestSupport {
ServerSession serverSession = (ServerSession) session;
serverSession.setPasswordAuthenticator(passAuth);
serverSession.setUserAuthFactories(
- Collections.<NamedFactory<UserAuth>>singletonList(
+ Collections.singletonList(
ServerAuthenticationManager.Utils.DEFAULT_USER_AUTH_PASSWORD_FACTORY));
}
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/server/auth/WelcomeBannerTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/auth/WelcomeBannerTest.java b/sshd-core/src/test/java/org/apache/sshd/server/auth/WelcomeBannerTest.java
index e3e40f2..e62e8de 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/auth/WelcomeBannerTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/auth/WelcomeBannerTest.java
@@ -104,7 +104,7 @@ public class WelcomeBannerTest extends BaseTestSupport {
@Test
public void testPathBanner() throws Exception {
- testFileContentBanner(Function.<Path>identity());
+ testFileContentBanner(Function.identity());
}
@Test