This is an automated email from the ASF dual-hosted git repository. lgoldstein pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mina-sshd.git
The following commit(s) were added to refs/heads/master by this push: new f25d800e8 Fixed some minor comment warnings f25d800e8 is described below commit f25d800e893eb1e3d3d59ed5043826a7c19152ef Author: Lyor Goldstein <lgoldst...@apache.org> AuthorDate: Thu Dec 7 08:33:04 2023 +0200 Fixed some minor comment warnings --- .../apache/sshd/common/io/AbstractIoWriteFuture.java | 1 + .../common/file/root/RootedFileSystemProviderTest.java | 18 ++++++++++++++---- .../auth/pubkey/PublicKeyAuthenticationReporter.java | 9 +++++---- .../java/org/apache/sshd/client/future/AuthFuture.java | 4 ++-- .../apache/sshd/common/channel/AbstractChannel.java | 3 ++- .../java/org/apache/sshd/common/session/Session.java | 1 + .../sshd/common/session/helpers/AbstractSession.java | 10 +++++----- .../session/helpers/KeyExchangeMessageHandler.java | 18 ++++++++++-------- .../apache/sshd/server/channel/ChannelSessionTest.java | 2 +- 9 files changed, 41 insertions(+), 25 deletions(-) diff --git a/sshd-common/src/main/java/org/apache/sshd/common/io/AbstractIoWriteFuture.java b/sshd-common/src/main/java/org/apache/sshd/common/io/AbstractIoWriteFuture.java index 3efe0792f..71eac93e4 100644 --- a/sshd-common/src/main/java/org/apache/sshd/common/io/AbstractIoWriteFuture.java +++ b/sshd-common/src/main/java/org/apache/sshd/common/io/AbstractIoWriteFuture.java @@ -67,6 +67,7 @@ public abstract class AbstractIoWriteFuture public static IoWriteFuture fulfilled(Object id, Object value) { AbstractIoWriteFuture result = new AbstractIoWriteFuture(id, null) { + // Nothing extra }; result.setValue(Objects.requireNonNull(value)); return result; diff --git a/sshd-common/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java b/sshd-common/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java index 2520753ab..d6ceedfb5 100644 --- a/sshd-common/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java +++ b/sshd-common/src/test/java/org/apache/sshd/common/file/root/RootedFileSystemProviderTest.java @@ -27,7 +27,16 @@ import java.nio.ByteBuffer; import java.nio.channels.Channel; import java.nio.channels.FileChannel; import java.nio.charset.StandardCharsets; -import java.nio.file.*; +import java.nio.file.DirectoryStream; +import java.nio.file.FileSystem; +import java.nio.file.Files; +import java.nio.file.InvalidPathException; +import java.nio.file.LinkOption; +import java.nio.file.NoSuchFileException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -362,9 +371,10 @@ public class RootedFileSystemProviderTest extends AssertableFile { } /** - * Tests to make sure that the attempted break out of the chroot does not work with the specified filename + * Tests to make sure that the attempted break out of the {@code chroot} does not work with the specified filename * - * @param fileName the filename to attempt to break out of the chroot with + * @param fileName the filename to attempt to break out of the {@code chroot} with + * @param expected the expected attempt result * @throws IOException on test failure */ private void testBreakOutOfChroot(String fileName, String expected) throws IOException { @@ -535,7 +545,7 @@ public class RootedFileSystemProviderTest extends AssertableFile { public Path createFile(Path source) throws InvalidPathException, IOException { try (FileChannel fc = fileSystem.provider().newFileChannel(source, - new TreeSet<OpenOption>(Arrays.asList(StandardOpenOption.CREATE, StandardOpenOption.WRITE)))) { + new TreeSet<>(Arrays.asList(StandardOpenOption.CREATE, StandardOpenOption.WRITE)))) { byte[] randomBytes = new byte[1000]; new Random().nextBytes(randomBytes); fc.write(ByteBuffer.wrap(randomBytes)); diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/PublicKeyAuthenticationReporter.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/PublicKeyAuthenticationReporter.java index da4eaa054..09a85d7a0 100644 --- a/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/PublicKeyAuthenticationReporter.java +++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/PublicKeyAuthenticationReporter.java @@ -64,10 +64,11 @@ public interface PublicKeyAuthenticationReporter { /** * A {@link KeyPair} is is present, but is not attempted because no signature factory for it could be found. * - * @param session The {@link ClientSession} - * @param service The requesting service name - * @param identity The {@link KeyPair} identity being skipped - <B>Note:</B> for agent based authentications the - * private key may be {@code null} + * @param session The {@link ClientSession} + * @param service The requesting service name + * @param identity The {@link KeyPair} identity being skipped - <B>Note:</B> for agent based authentications the + * private key may be {@code null} + * @throws Exception If failed to handle the callback - <B>Note:</B> may cause session close */ default void signalIdentitySkipped(ClientSession session, String service, KeyPair identity) throws Exception { // ignored diff --git a/sshd-core/src/main/java/org/apache/sshd/client/future/AuthFuture.java b/sshd-core/src/main/java/org/apache/sshd/client/future/AuthFuture.java index 122ac8c91..644406cae 100644 --- a/sshd-core/src/main/java/org/apache/sshd/client/future/AuthFuture.java +++ b/sshd-core/src/main/java/org/apache/sshd/client/future/AuthFuture.java @@ -64,11 +64,11 @@ public interface AuthFuture extends SshFuture<AuthFuture>, VerifiableFuture<Auth /** * Tells whether {@link #cancel()} was called on this {@link AuthFuture}. * <p> - * This is different from {@link #isCanceled()}. Cancelling an on-going authentication may not be possible; + * This is different from {@link #isCanceled()}. Canceling an on-going authentication may not be possible; * {@link #cancel()} is only a <em>request</em> to cancel the authentication. That request may not be honored and * the {@link org.apache.sshd.common.future.CancelFuture CancelFuture} may actually be * {@link org.apache.sshd.common.future.CancelFuture#isCanceled() isCanceled()} {@code == false}. - * {@link AuthFuture}.{@link isCanceled()} is then {@code false}, too. + * {@link AuthFuture}.{@link #isCanceled()} is then {@code false}, too. * </p> * * @return {@code true} if {@link #cancel()} was called, {@code false} otherwise diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java index 0f10a823d..cb52d2c18 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java @@ -914,7 +914,7 @@ public abstract class AbstractChannel extends AbstractInnerCloseable implements /** * Sets a {@link PacketValidator}. * - * @param the validator to set, if {@code null} the {@link #DEFAULT_PACKET_VALIDATOR} is set + * @param validator the validator to set, if {@code null} the {@link #DEFAULT_PACKET_VALIDATOR} is set */ public void setPacketValidator(PacketValidator validator) { if (validator == null) { @@ -991,6 +991,7 @@ public abstract class AbstractChannel extends AbstractInnerCloseable implements } AbstractIoWriteFuture eofWritten = new AbstractIoWriteFuture(getChannelId(), futureLock) { + // Nothin extra }; if (!eofFuture.compareAndSet(null, eofWritten)) { if (log.isDebugEnabled()) { 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 b67432ae4..07eb80fd7 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 @@ -241,6 +241,7 @@ public interface Session * appropriate * @param request the request name * @param replyHandler {@link ReplyHandler} for handling the reply; may be {@code null} + * @return Created {@link GlobalRequestFuture} * @throws IOException if an error occurred while encoding or sending the packet */ GlobalRequestFuture request(Buffer buffer, String request, ReplyHandler replyHandler) diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java index 908041698..4bdb39c4c 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java @@ -268,11 +268,11 @@ public abstract class AbstractSession extends SessionHelper { * * @see <a href="https://tools.ietf.org/html/rfc4254#section-4">RFC 4254: Global Requests</a> * @see <a href="https://tools.ietf.org/html/rfc4253#section-11.4">RFC 4254: Reserved Messages</a> - * @see {@link #request(Buffer, String, org.apache.sshd.common.future.GlobalRequestFuture.ReplyHandler)} - * @see {@link #requestSuccess(Buffer)} - * @see {@link #requestFailure(Buffer)} - * @see {@link #doInvokeUnimplementedMessageHandler(int, Buffer)} - * @see {@link #preClose()} + * @see #request(Buffer, String, org.apache.sshd.common.future.GlobalRequestFuture.ReplyHandler) + * @see #requestSuccess(Buffer) + * @see #requestFailure(Buffer) + * @see #doInvokeUnimplementedMessageHandler(int, Buffer) + * @see #preClose() */ private final Deque<GlobalRequestFuture> pendingGlobalRequests = new ConcurrentLinkedDeque<>(); diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/KeyExchangeMessageHandler.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/KeyExchangeMessageHandler.java index c426d080e..4ad8db4e1 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/KeyExchangeMessageHandler.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/KeyExchangeMessageHandler.java @@ -50,7 +50,7 @@ import org.slf4j.Logger; /** * Manages SSH message sending during a key exchange. RFC 4253 specifies that during a key exchange, no high-level * messages are to be sent, but a receiver must be able to deal with messages "in flight" until the peer's - * {@link SshConstants#SSH_MSG_KEX_INIT} message is received. + * {@link SshConstants#SSH_MSG_KEXINIT} message is received. * <p> * Apache MINA sshd queues up high-level messages that threads try to send while a key exchange is ongoing, and sends * them once the key exchange is done. Sending queued messages may make the peer re-trigger a new key exchange, in which @@ -165,11 +165,11 @@ public class KeyExchangeMessageHandler { } /** - * Initializes the state for a new key exchange. {@link #allPacketsFlushed()} will be {@code false}, and a new - * future to be fulfilled when all queued packets will be flushed once the key exchange is done is set. The - * currently set future from an earlier key exchange is returned. The returned future may or may not be fulfilled; - * if it isn't, there are still left-over pending packets to write from the previous key exchange, which will be - * written once the new key exchange flushes pending packets. + * Initializes the state for a new key exchange. {@code allPacketsFlushed} will be {@code false}, and a new future + * to be fulfilled when all queued packets will be flushed once the key exchange is done is set. The currently set + * future from an earlier key exchange is returned. The returned future may or may not be fulfilled; if it isn't, + * there are still left-over pending packets to write from the previous key exchange, which will be written once the + * new key exchange flushes pending packets. * * @return the previous {@link DefaultKeyExchangeFuture} indicating whether all pending packets were flushed. */ @@ -204,7 +204,7 @@ public class KeyExchangeMessageHandler { shutDown.set(true); SimpleImmutableEntry<Integer, DefaultKeyExchangeFuture> items = updateState(() -> { kexFlushed.set(true); - return new SimpleImmutableEntry<Integer, DefaultKeyExchangeFuture>( + return new SimpleImmutableEntry<>( Integer.valueOf(pendingPackets.size()), kexFlushedFuture.get()); }); @@ -419,7 +419,7 @@ public class KeyExchangeMessageHandler { * exchange, flushing is stopped and is to be resumed by another call to this method when the new key exchange is * done. * - * @param flushDone the future obtained from {@link #getFlushedFuture()}; will be fulfilled once all pending packets + * @param flushDone the future obtained from {@code getFlushedFuture}; will be fulfilled once all pending packets * have been written */ protected void flushQueue(DefaultKeyExchangeFuture flushDone) { @@ -455,6 +455,7 @@ public class KeyExchangeMessageHandler { if (!session.isOpen()) { log.info("flushQueue({}): Session closed while flushing pending packets at end of KEX", session); AbstractIoWriteFuture aborted = new AbstractIoWriteFuture(session, null) { + // Nothing extra }; aborted.setValue(new SshException("Session closed while flushing pending packets at end of KEX")); drainQueueTo(pendingFutures, aborted); @@ -505,6 +506,7 @@ public class KeyExchangeMessageHandler { log.error("flushQueue({}): Exception while flushing packet at end of KEX for {}", session, pending.getId(), e); AbstractIoWriteFuture aborted = new AbstractIoWriteFuture(pending.getId(), null) { + // Nothing extra }; aborted.setValue(e); pendingFutures.add(new SimpleImmutableEntry<>(pending, aborted)); diff --git a/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java b/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java index b09f560e1..0562fb623 100644 --- a/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java +++ b/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java @@ -57,7 +57,7 @@ public class ChannelSessionTest extends BaseTestSupport { super(); } - /** + /* * Testing a command closing output stream when it completes */ @Test // see SSHD-1257