Repository: mina-sshd Updated Branches: refs/heads/master 3668d92e4 -> e7a75e42f
[SSHD-842] Remove some older API(s) that were using java.io.File instead of java.nio.file.Path Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/e7a75e42 Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/e7a75e42 Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/e7a75e42 Branch: refs/heads/master Commit: e7a75e42fbd32c9c826cb8ca20dabd9505905afe Parents: 3668d92 Author: Lyor Goldstein <[email protected]> Authored: Sat Sep 8 19:04:09 2018 +0300 Committer: Lyor Goldstein <[email protected]> Committed: Mon Sep 10 17:11:01 2018 +0300 ---------------------------------------------------------------------- .../apache/sshd/cli/server/SshFsMounter.java | 2 +- .../hosts/ConfigFileHostEntryResolver.java | 5 --- .../DefaultConfigFileHostEntryResolver.java | 8 ----- .../client/config/hosts/HostConfigEntry.java | 33 +++++++------------- .../client/config/hosts/KnownHostEntry.java | 6 ---- .../common/config/ConfigFileReaderSupport.java | 6 ---- .../common/config/keys/AuthorizedKeyEntry.java | 15 --------- .../apache/sshd/common/util/SelectorUtils.java | 30 ++---------------- .../common/util/io/ModifiableFileWatcher.java | 9 ++---- .../security/eddsa/Ed25519PublicKeyDecoder.java | 3 +- .../OpenSSHEd25519PrivateKeyEntryDecoder.java | 3 +- .../AbstractGeneratorHostKeyProvider.java | 5 --- .../SimpleGeneratorHostKeyProvider.java | 5 --- .../java/org/apache/sshd/client/SshClient.java | 2 +- .../org/apache/sshd/common/channel/Channel.java | 4 +-- .../sshd/common/io/IoServiceEventListener.java | 10 ++++-- .../org/apache/sshd/common/session/Session.java | 2 +- .../keys/AuthorizedKeysAuthenticator.java | 5 --- .../DefaultAuthorizedKeysAuthenticator.java | 10 ------ .../sshd/server/config/keys/ServerIdentity.java | 2 +- 20 files changed, 33 insertions(+), 132 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-cli/src/test/java/org/apache/sshd/cli/server/SshFsMounter.java ---------------------------------------------------------------------- diff --git a/sshd-cli/src/test/java/org/apache/sshd/cli/server/SshFsMounter.java b/sshd-cli/src/test/java/org/apache/sshd/cli/server/SshFsMounter.java index 37cf8bc..7a15421 100644 --- a/sshd-cli/src/test/java/org/apache/sshd/cli/server/SshFsMounter.java +++ b/sshd-cli/src/test/java/org/apache/sshd/cli/server/SshFsMounter.java @@ -314,7 +314,7 @@ public final class SshFsMounter extends SshServerCliSupport { if (SecurityUtils.isBouncyCastleRegistered()) { sshd.setKeyPairProvider(SecurityUtils.createGeneratorHostKeyProvider(new File(targetFolder, "key.pem").toPath())); } else { - sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File(targetFolder, "key.ser"))); + sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File(targetFolder, "key.ser").toPath())); } // Should come AFTER key pair provider setup so auto-welcome can be generated if needed setupServerBanner(sshd, resolver); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolver.java ---------------------------------------------------------------------- diff --git a/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolver.java b/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolver.java index f1c9ea8..e14ed9f 100644 --- a/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolver.java +++ b/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/ConfigFileHostEntryResolver.java @@ -19,7 +19,6 @@ package org.apache.sshd.client.config.hosts; -import java.io.File; import java.io.IOException; import java.nio.file.LinkOption; import java.nio.file.Path; @@ -41,10 +40,6 @@ public class ConfigFileHostEntryResolver extends ModifiableFileWatcher implement private final AtomicReference<HostConfigEntryResolver> delegateHolder = // assumes initially empty new AtomicReference<>(HostConfigEntryResolver.EMPTY); - public ConfigFileHostEntryResolver(File file) { - this(Objects.requireNonNull(file, "No file to watch").toPath()); - } - public ConfigFileHostEntryResolver(Path file) { this(file, IoUtils.EMPTY_LINK_OPTIONS); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/DefaultConfigFileHostEntryResolver.java ---------------------------------------------------------------------- diff --git a/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/DefaultConfigFileHostEntryResolver.java b/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/DefaultConfigFileHostEntryResolver.java index 29bc355..7fc500c 100644 --- a/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/DefaultConfigFileHostEntryResolver.java +++ b/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/DefaultConfigFileHostEntryResolver.java @@ -19,16 +19,12 @@ package org.apache.sshd.client.config.hosts; -import java.io.File; import java.io.IOException; import java.nio.file.LinkOption; import java.nio.file.Path; import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.Objects; - -import org.apache.sshd.common.util.io.IoUtils; /** * Monitors the {@code ~/.ssh/config} file of the user currently running @@ -55,10 +51,6 @@ public class DefaultConfigFileHostEntryResolver extends ConfigFileHostEntryResol this(HostConfigEntry.getDefaultHostConfigFile(), strict); } - public DefaultConfigFileHostEntryResolver(File file, boolean strict) { - this(Objects.requireNonNull(file, "No file provided").toPath(), strict, IoUtils.getLinkOptions(true)); - } - public DefaultConfigFileHostEntryResolver(Path path, boolean strict, LinkOption... options) { super(path, options); this.strict = strict; http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java ---------------------------------------------------------------------- diff --git a/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java b/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java index 8a05d75..cb85cea 100644 --- a/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java +++ b/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java @@ -86,11 +86,11 @@ public class HostConfigEntry extends HostPatternsHolder implements MutableUserHo * A case <U>insensitive</U> {@link Set} of the properties that receive special handling */ public static final Set<String> EXPLICIT_PROPERTIES = - Collections.unmodifiableSet( - GenericUtils.asSortedSet(String.CASE_INSENSITIVE_ORDER, - HOST_CONFIG_PROP, HOST_NAME_CONFIG_PROP, PORT_CONFIG_PROP, - USER_CONFIG_PROP, IDENTITY_FILE_CONFIG_PROP, EXCLUSIVE_IDENTITIES_CONFIG_PROP - )); + Collections.unmodifiableSet( + GenericUtils.asSortedSet(String.CASE_INSENSITIVE_ORDER, + HOST_CONFIG_PROP, HOST_NAME_CONFIG_PROP, PORT_CONFIG_PROP, + USER_CONFIG_PROP, IDENTITY_FILE_CONFIG_PROP, EXCLUSIVE_IDENTITIES_CONFIG_PROP + )); public static final String MULTI_VALUE_SEPARATORS = " ,"; @@ -220,13 +220,6 @@ public class HostConfigEntry extends HostPatternsHolder implements MutableUserHo } /** - * @param file A {@link File} that contains an identity key - never {@code null} - */ - public void addIdentity(File file) { - addIdentity(Objects.requireNonNull(file, "No file").toPath()); - } - - /** * @param path A {@link Path} to a file that contains an identity key * - never {@code null} */ @@ -785,10 +778,6 @@ public class HostConfigEntry extends HostPatternsHolder implements MutableUserHo } } - public static List<HostConfigEntry> readHostConfigEntries(File file) throws IOException { - return readHostConfigEntries(file.toPath(), IoUtils.EMPTY_OPEN_OPTIONS); - } - public static List<HostConfigEntry> readHostConfigEntries(Path path, OpenOption... options) throws IOException { try (InputStream input = Files.newInputStream(path, options)) { return readHostConfigEntries(input, true); @@ -1012,17 +1001,17 @@ public class HostConfigEntry extends HostPatternsHolder implements MutableUserHo return entries; } - public static void writeHostConfigEntries(File file, Collection<? extends HostConfigEntry> entries) throws IOException { - writeHostConfigEntries(Objects.requireNonNull(file, "No file").toPath(), entries, IoUtils.EMPTY_OPEN_OPTIONS); - } - - public static void writeHostConfigEntries(Path path, Collection<? extends HostConfigEntry> entries, OpenOption... options) throws IOException { + public static void writeHostConfigEntries( + Path path, Collection<? extends HostConfigEntry> entries, OpenOption... options) + throws IOException { try (OutputStream outputStream = Files.newOutputStream(path, options)) { writeHostConfigEntries(outputStream, true, entries); } } - public static void writeHostConfigEntries(OutputStream outputStream, boolean okToClose, Collection<? extends HostConfigEntry> entries) throws IOException { + public static void writeHostConfigEntries( + OutputStream outputStream, boolean okToClose, Collection<? extends HostConfigEntry> entries) + throws IOException { if (GenericUtils.isEmpty(entries)) { return; } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/KnownHostEntry.java ---------------------------------------------------------------------- diff --git a/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/KnownHostEntry.java b/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/KnownHostEntry.java index bcaf965..91d6184 100644 --- a/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/KnownHostEntry.java +++ b/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/KnownHostEntry.java @@ -20,7 +20,6 @@ package org.apache.sshd.client.config.hosts; import java.io.BufferedReader; -import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -41,7 +40,6 @@ import org.apache.sshd.common.config.keys.AuthorizedKeyEntry; import org.apache.sshd.common.config.keys.PublicKeyEntry; import org.apache.sshd.common.util.GenericUtils; import org.apache.sshd.common.util.ValidateUtils; -import org.apache.sshd.common.util.io.IoUtils; import org.apache.sshd.common.util.io.NoCloseInputStream; import org.apache.sshd.common.util.io.NoCloseReader; @@ -145,10 +143,6 @@ public class KnownHostEntry extends HostPatternsHolder { return LazyDefaultConfigFileHolder.HOSTS_FILE; } - public static List<KnownHostEntry> readKnownHostEntries(File file) throws IOException { - return readKnownHostEntries(file.toPath(), IoUtils.EMPTY_OPEN_OPTIONS); - } - public static List<KnownHostEntry> readKnownHostEntries(Path path, OpenOption... options) throws IOException { try (InputStream input = Files.newInputStream(path, options)) { return readKnownHostEntries(input, true); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-common/src/main/java/org/apache/sshd/common/config/ConfigFileReaderSupport.java ---------------------------------------------------------------------- diff --git a/sshd-common/src/main/java/org/apache/sshd/common/config/ConfigFileReaderSupport.java b/sshd-common/src/main/java/org/apache/sshd/common/config/ConfigFileReaderSupport.java index 10b131c..aea9f24 100644 --- a/sshd-common/src/main/java/org/apache/sshd/common/config/ConfigFileReaderSupport.java +++ b/sshd-common/src/main/java/org/apache/sshd/common/config/ConfigFileReaderSupport.java @@ -20,7 +20,6 @@ package org.apache.sshd.common.config; import java.io.BufferedReader; -import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -37,7 +36,6 @@ import java.util.concurrent.TimeUnit; import org.apache.sshd.common.keyprovider.KeyPairProvider; import org.apache.sshd.common.util.GenericUtils; -import org.apache.sshd.common.util.io.IoUtils; import org.apache.sshd.common.util.io.NoCloseInputStream; import org.apache.sshd.common.util.io.NoCloseReader; import org.apache.sshd.common.util.net.SshdSocketAddress; @@ -114,10 +112,6 @@ public final class ConfigFileReaderSupport { throw new UnsupportedOperationException("No instance"); } - public static Properties readConfigFile(File file) throws IOException { - return readConfigFile(file.toPath(), IoUtils.EMPTY_OPEN_OPTIONS); - } - public static Properties readConfigFile(Path path, OpenOption... options) throws IOException { try (InputStream input = Files.newInputStream(path, options)) { return readConfigFile(input, true); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-common/src/main/java/org/apache/sshd/common/config/keys/AuthorizedKeyEntry.java ---------------------------------------------------------------------- diff --git a/sshd-common/src/main/java/org/apache/sshd/common/config/keys/AuthorizedKeyEntry.java b/sshd-common/src/main/java/org/apache/sshd/common/config/keys/AuthorizedKeyEntry.java index c03616c..eb7e1fb 100644 --- a/sshd-common/src/main/java/org/apache/sshd/common/config/keys/AuthorizedKeyEntry.java +++ b/sshd-common/src/main/java/org/apache/sshd/common/config/keys/AuthorizedKeyEntry.java @@ -20,7 +20,6 @@ package org.apache.sshd.common.config.keys; import java.io.BufferedReader; -import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -180,20 +179,6 @@ public class AuthorizedKeyEntry extends PublicKeyEntry { /** * Reads read the contents of an <code>authorized_keys</code> file * - * @param file The {@link File} to read from - * @return A {@link List} of all the {@link AuthorizedKeyEntry}-ies found there - * @throws IOException If failed to read or parse the entries - * @see #readAuthorizedKeys(InputStream, boolean) - */ - public static List<AuthorizedKeyEntry> readAuthorizedKeys(File file) throws IOException { - try (InputStream in = new FileInputStream(file)) { - return readAuthorizedKeys(in, true); - } - } - - /** - * Reads read the contents of an <code>authorized_keys</code> file - * * @param path {@link Path} to read from * @param options The {@link OpenOption}s to use - if unspecified then appropriate * defaults assumed http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-common/src/main/java/org/apache/sshd/common/util/SelectorUtils.java ---------------------------------------------------------------------- diff --git a/sshd-common/src/main/java/org/apache/sshd/common/util/SelectorUtils.java b/sshd-common/src/main/java/org/apache/sshd/common/util/SelectorUtils.java index 53bca90..95975c2 100644 --- a/sshd-common/src/main/java/org/apache/sshd/common/util/SelectorUtils.java +++ b/sshd-common/src/main/java/org/apache/sshd/common/util/SelectorUtils.java @@ -761,33 +761,9 @@ public final class SelectorUtils { } /** - * Returns dependency information on these two files. If src has been - * modified later than target, it returns true. If target doesn't exist, - * it likewise returns true. Otherwise, target is newer than src and - * is not out of date, thus the method returns false. It also returns - * false if the src file doesn't even exist, since how could the - * target then be out of date. - * - * @param src the original file - * @param target the file being compared against - * @param granularity the amount in seconds of slack we will give in - * determining out of dateness - * @return whether the target is out of date - */ - public static boolean isOutOfDate(File src, File target, int granularity) { - if (!src.exists()) { - return false; - } - if (!target.exists()) { - return true; - } - return (src.lastModified() - granularity) > target.lastModified(); - } - - /** - * "Flattens" a string by removing all whitespace (space, tab, linefeed, - * carriage return, and formfeed). This uses StringTokenizer and the - * default set of tokens as documented in the single arguement constructor. + * "Flattens" a string by removing all whitespace (space, tab, line-feed, + * carriage return, and form-feed). This uses StringTokenizer and the + * default set of tokens as documented in the single argument constructor. * * @param input a String to remove all whitespace. * @return a String that has had all whitespace removed. http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-common/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java ---------------------------------------------------------------------- diff --git a/sshd-common/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java b/sshd-common/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java index 032260b..29ca54d 100644 --- a/sshd-common/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java +++ b/sshd-common/src/main/java/org/apache/sshd/common/util/io/ModifiableFileWatcher.java @@ -19,7 +19,6 @@ package org.apache.sshd.common.util.io; -import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.LinkOption; @@ -54,8 +53,8 @@ public class ModifiableFileWatcher extends AbstractLoggingBean { * permissions are enforced on key files */ public static final Set<PosixFilePermission> STRICTLY_PROHIBITED_FILE_PERMISSION = - Collections.unmodifiableSet( - EnumSet.of(PosixFilePermission.GROUP_WRITE, PosixFilePermission.OTHERS_WRITE)); + Collections.unmodifiableSet( + EnumSet.of(PosixFilePermission.GROUP_WRITE, PosixFilePermission.OTHERS_WRITE)); protected final LinkOption[] options; @@ -64,10 +63,6 @@ public class ModifiableFileWatcher extends AbstractLoggingBean { private final AtomicLong lastSize = new AtomicLong(Long.MIN_VALUE); private final AtomicLong lastModified = new AtomicLong(-1L); - public ModifiableFileWatcher(File file) { - this(Objects.requireNonNull(file, "No file to watch").toPath()); - } - public ModifiableFileWatcher(Path file) { this(file, IoUtils.getLinkOptions(true)); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-common/src/main/java/org/apache/sshd/common/util/security/eddsa/Ed25519PublicKeyDecoder.java ---------------------------------------------------------------------- diff --git a/sshd-common/src/main/java/org/apache/sshd/common/util/security/eddsa/Ed25519PublicKeyDecoder.java b/sshd-common/src/main/java/org/apache/sshd/common/util/security/eddsa/Ed25519PublicKeyDecoder.java index 793965c..3366510 100644 --- a/sshd-common/src/main/java/org/apache/sshd/common/util/security/eddsa/Ed25519PublicKeyDecoder.java +++ b/sshd-common/src/main/java/org/apache/sshd/common/util/security/eddsa/Ed25519PublicKeyDecoder.java @@ -44,7 +44,8 @@ public final class Ed25519PublicKeyDecoder extends AbstractPublicKeyEntryDecoder public static final Ed25519PublicKeyDecoder INSTANCE = new Ed25519PublicKeyDecoder(); private Ed25519PublicKeyDecoder() { - super(EdDSAPublicKey.class, EdDSAPrivateKey.class, Collections.unmodifiableList(Collections.singletonList(KeyPairProvider.SSH_ED25519))); + super(EdDSAPublicKey.class, EdDSAPrivateKey.class, + Collections.unmodifiableList(Collections.singletonList(KeyPairProvider.SSH_ED25519))); } @Override http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-common/src/main/java/org/apache/sshd/common/util/security/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java ---------------------------------------------------------------------- diff --git a/sshd-common/src/main/java/org/apache/sshd/common/util/security/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java b/sshd-common/src/main/java/org/apache/sshd/common/util/security/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java index 4888818..d707d47 100644 --- a/sshd-common/src/main/java/org/apache/sshd/common/util/security/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java +++ b/sshd-common/src/main/java/org/apache/sshd/common/util/security/eddsa/OpenSSHEd25519PrivateKeyEntryDecoder.java @@ -55,7 +55,8 @@ public class OpenSSHEd25519PrivateKeyEntryDecoder extends AbstractPrivateKeyEntr private static final int KEYPAIR_SIZE = PK_SIZE + SK_SIZE; public OpenSSHEd25519PrivateKeyEntryDecoder() { - super(EdDSAPublicKey.class, EdDSAPrivateKey.class, Collections.unmodifiableList(Collections.singletonList(KeyPairProvider.SSH_ED25519))); + super(EdDSAPublicKey.class, EdDSAPrivateKey.class, + Collections.unmodifiableList(Collections.singletonList(KeyPairProvider.SSH_ED25519))); } @Override http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-common/src/main/java/org/apache/sshd/server/keyprovider/AbstractGeneratorHostKeyProvider.java ---------------------------------------------------------------------- diff --git a/sshd-common/src/main/java/org/apache/sshd/server/keyprovider/AbstractGeneratorHostKeyProvider.java b/sshd-common/src/main/java/org/apache/sshd/server/keyprovider/AbstractGeneratorHostKeyProvider.java index 9131f99..f43f5c0 100644 --- a/sshd-common/src/main/java/org/apache/sshd/server/keyprovider/AbstractGeneratorHostKeyProvider.java +++ b/sshd-common/src/main/java/org/apache/sshd/server/keyprovider/AbstractGeneratorHostKeyProvider.java @@ -18,7 +18,6 @@ */ package org.apache.sshd.server.keyprovider; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -71,10 +70,6 @@ public abstract class AbstractGeneratorHostKeyProvider extends AbstractKeyPairPr return path; } - public void setFile(File file) { - setPath((file == null) ? null : file.toPath()); - } - public void setPath(Path path) { this.path = (path == null) ? null : path.toAbsolutePath(); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-common/src/main/java/org/apache/sshd/server/keyprovider/SimpleGeneratorHostKeyProvider.java ---------------------------------------------------------------------- diff --git a/sshd-common/src/main/java/org/apache/sshd/server/keyprovider/SimpleGeneratorHostKeyProvider.java b/sshd-common/src/main/java/org/apache/sshd/server/keyprovider/SimpleGeneratorHostKeyProvider.java index 3bccde8..7f2888e 100644 --- a/sshd-common/src/main/java/org/apache/sshd/server/keyprovider/SimpleGeneratorHostKeyProvider.java +++ b/sshd-common/src/main/java/org/apache/sshd/server/keyprovider/SimpleGeneratorHostKeyProvider.java @@ -18,7 +18,6 @@ */ package org.apache.sshd.server.keyprovider; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; @@ -39,10 +38,6 @@ public class SimpleGeneratorHostKeyProvider extends AbstractGeneratorHostKeyProv super(); } - public SimpleGeneratorHostKeyProvider(File file) { - this((file == null) ? null : file.toPath()); - } - public SimpleGeneratorHostKeyProvider(Path path) { setPath(path); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java b/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java index 76f2350..f4c2d8c 100644 --- a/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java +++ b/sshd-core/src/main/java/org/apache/sshd/client/SshClient.java @@ -816,7 +816,7 @@ public class SshClient extends AbstractFactoryManager implements ClientFactoryMa * {@link KeyPairProvider} was generated * @throws IOException If failed to access the file system * @throws GeneralSecurityException If failed to load the keys - * @see #loadDefaultKeyPairProvider(Path, boolean, boolean, FilePasswordProvider, LinkOption...) + * @see ClientIdentity#loadDefaultKeyPairProvider(Path, boolean, boolean, FilePasswordProvider, LinkOption...) */ public static <C extends SshClient> C setKeyPairProvider( C client, Path dir, boolean strict, boolean supportedOnly, FilePasswordProvider provider, LinkOption... options) http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-core/src/main/java/org/apache/sshd/common/channel/Channel.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/Channel.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/Channel.java index 1ef143a..099c095 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/channel/Channel.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/Channel.java @@ -225,8 +225,8 @@ public interface Channel * @param channel The {@link Channel} - ignored if {@code null} * @param key The attribute key - never {@code null} * @return Associated value - {@code null} if not found - * @see Session#getFactoryManager() - * @see #resolveAttribute(Session, AttributeKey) + * @see #getSession() + * @see Session#resolveAttribute(Session, AttributeKey) */ static <T> T resolveAttribute(Channel channel, AttributeKey<T> key) { Objects.requireNonNull(key, "No key"); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-core/src/main/java/org/apache/sshd/common/io/IoServiceEventListener.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/io/IoServiceEventListener.java b/sshd-core/src/main/java/org/apache/sshd/common/io/IoServiceEventListener.java index 7018825..53d6611 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/io/IoServiceEventListener.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/io/IoServiceEventListener.java @@ -45,7 +45,7 @@ public interface IoServiceEventListener extends SshdEventListener { * Called when a previously established connection has been abnormally terminated before it could be * turned into a session * - * @param acceptor The {@link IoConnector} through which the connection was established + * @param connector The {@link IoConnector} through which the connection was established * @param local The local connection endpoint * @param remote The remote connection endpoint * @param reason The reason for aborting - may be an exception thrown by @@ -53,7 +53,9 @@ public interface IoServiceEventListener extends SshdEventListener { * @throws IOException If failed to handle the event - the exception is logged but does not * prevent further connections from being accepted */ - default void abortEstablishedConnection(IoConnector connector, SocketAddress local, SocketAddress remote, Throwable reason) throws IOException { + default void abortEstablishedConnection( + IoConnector connector, SocketAddress local, SocketAddress remote, Throwable reason) + throws IOException { // Do nothing } @@ -82,7 +84,9 @@ public interface IoServiceEventListener extends SshdEventListener { * @throws IOException If failed to handle the event - the exception is logged but does not * prevent further connections from being accepted */ - default void abortAcceptedConnection(IoAcceptor acceptor, SocketAddress local, SocketAddress remote, Throwable reason) throws IOException { + default void abortAcceptedConnection( + IoAcceptor acceptor, SocketAddress local, SocketAddress remote, Throwable reason) + throws IOException { // Do nothing } } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java b/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java index f8e80c5..f9a3fea 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java @@ -343,7 +343,7 @@ public interface Session * @param key The attribute key - never {@code null} * @return Associated value - {@code null} if not found * @see Session#getFactoryManager() - * @see #resolveAttribute(FactoryManager, AttributeKey) + * @see FactoryManager#resolveAttribute(FactoryManager, AttributeKey) */ static <T> T resolveAttribute(Session session, AttributeKey<T> key) { Objects.requireNonNull(key, "No key"); http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java index b05837b..a2d577f 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/AuthorizedKeysAuthenticator.java @@ -19,7 +19,6 @@ package org.apache.sshd.server.config.keys; -import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.LinkOption; @@ -70,10 +69,6 @@ public class AuthorizedKeysAuthenticator extends ModifiableFileWatcher implement private final AtomicReference<PublickeyAuthenticator> delegateHolder = // assumes initially reject-all new AtomicReference<>(RejectAllPublickeyAuthenticator.INSTANCE); - public AuthorizedKeysAuthenticator(File file) { - this(Objects.requireNonNull(file, "No file to watch").toPath()); - } - public AuthorizedKeysAuthenticator(Path file) { this(file, IoUtils.EMPTY_LINK_OPTIONS); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-core/src/main/java/org/apache/sshd/server/config/keys/DefaultAuthorizedKeysAuthenticator.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/DefaultAuthorizedKeysAuthenticator.java b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/DefaultAuthorizedKeysAuthenticator.java index 9fac9e6..d950ee2 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/DefaultAuthorizedKeysAuthenticator.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/DefaultAuthorizedKeysAuthenticator.java @@ -19,7 +19,6 @@ package org.apache.sshd.server.config.keys; -import java.io.File; import java.io.IOException; import java.nio.file.FileSystemException; import java.nio.file.LinkOption; @@ -28,7 +27,6 @@ import java.nio.file.attribute.PosixFilePermission; import java.util.Collection; import java.util.Collections; import java.util.Map; -import java.util.Objects; import org.apache.sshd.common.auth.UsernameHolder; import org.apache.sshd.common.config.keys.AuthorizedKeyEntry; @@ -69,14 +67,6 @@ public class DefaultAuthorizedKeysAuthenticator extends AuthorizedKeysAuthentica this(user, getDefaultAuthorizedKeysFile(), strict); } - public DefaultAuthorizedKeysAuthenticator(File file, boolean strict) { - this(Objects.requireNonNull(file, "No file provided").toPath(), strict, IoUtils.getLinkOptions(true)); - } - - public DefaultAuthorizedKeysAuthenticator(String user, File file, boolean strict) { - this(user, Objects.requireNonNull(file, "No file provided").toPath(), strict, IoUtils.getLinkOptions(true)); - } - public DefaultAuthorizedKeysAuthenticator(Path path, boolean strict, LinkOption... options) { this(OsUtils.getCurrentUser(), path, strict, options); } http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e7a75e42/sshd-core/src/main/java/org/apache/sshd/server/config/keys/ServerIdentity.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/ServerIdentity.java b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/ServerIdentity.java index a15199a..0823a8f 100644 --- a/sshd-core/src/main/java/org/apache/sshd/server/config/keys/ServerIdentity.java +++ b/sshd-core/src/main/java/org/apache/sshd/server/config/keys/ServerIdentity.java @@ -132,7 +132,7 @@ public final class ServerIdentity { * @throws IOException If failed to access the file system * @see #getIdentityType(String) * @see #HOST_KEY_CONFIG_PROP - * @see org.apache.sshd.common.config.SshConfigFileReader#readConfigFile(File) + * @see org.apache.sshd.common.config.ConfigFileReaderSupport#readConfigFile(Path, java.nio.file.OpenOption...) */ public static Map<String, Path> findIdentities(Properties props, LinkOption... options) throws IOException { if (GenericUtils.isEmpty(props)) {
