Repository: mina-sshd Updated Branches: refs/heads/eddsa 46662d0c5 -> 6c1a85281
Join client identities watcher Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/6c1a8528 Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/6c1a8528 Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/6c1a8528 Branch: refs/heads/eddsa Commit: 6c1a8528171310472c6d6bfe035cd53e461724eb Parents: 46662d0 Author: Lyor Goldstein <lyor.goldst...@gmail.com> Authored: Thu Mar 23 22:02:44 2017 +0200 Committer: Lyor Goldstein <lyor.goldst...@gmail.com> Committed: Thu Mar 23 22:02:44 2017 +0200 ---------------------------------------------------------------------- .../client/config/keys/ClientIdentitiesWatcher.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/6c1a8528/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentitiesWatcher.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentitiesWatcher.java b/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentitiesWatcher.java index 6c2bb0b..094766f 100644 --- a/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentitiesWatcher.java +++ b/sshd-core/src/main/java/org/apache/sshd/client/config/keys/ClientIdentitiesWatcher.java @@ -76,7 +76,7 @@ public class ClientIdentitiesWatcher extends AbstractKeyPairProvider implements return loadKeys(null); } - protected Iterable<KeyPair> loadKeys(Predicate<KeyPair> filter) { + protected Iterable<KeyPair> loadKeys(Predicate<? super KeyPair> filter) { return () -> { Stream<KeyPair> stream = safeMap(GenericUtils.stream(providers), this::doGetKeyPair); if (filter != null) { @@ -89,14 +89,20 @@ public class ClientIdentitiesWatcher extends AbstractKeyPairProvider implements /** * Performs a mapping operation on the stream, discarding any null values * returned by the mapper. + * + * @param <U> Original type + * @param <V> Mapped type + * @param stream Original values stream + * @param mapper Mapper to target type + * @return Mapped stream */ - private <U, V> Stream<V> safeMap(Stream<U> stream, Function<U, V> mapper) { + protected <U, V> Stream<V> safeMap(Stream<U> stream, Function<? super U, ? extends V> mapper) { return stream.map(u -> Optional.ofNullable(mapper.apply(u))) .filter(Optional::isPresent) .map(Optional::get); } - private KeyPair doGetKeyPair(ClientIdentityProvider p) { + protected KeyPair doGetKeyPair(ClientIdentityProvider p) { try { KeyPair kp = p.getClientIdentity(); if (kp == null) {