You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by lg...@apache.org on 2022/02/08 16:37:38 UTC

[mina-sshd] 03/05: [SSHD-1244] Renamed Channel#getId to Channel#getChannelId and moved it to its own interface

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

commit 7f1a4be462982d417a7df9f7806e559297265797
Author: Lyor Goldstein <lg...@apache.org>
AuthorDate: Fri Feb 4 13:57:41 2022 +0200

    [SSHD-1244] Renamed Channel#getId to Channel#getChannelId and moved it to its own interface
---
 CHANGES.md                                                     |  2 +-
 .../org/apache/sshd/common/session/SessionContextHolder.java   |  1 +
 .../ChannelIdTrackingUnknownChannelReferenceHandler.java       |  2 +-
 .../org/apache/sshd/client/channel/AbstractClientChannel.java  |  4 ++--
 .../org/apache/sshd/client/channel/ChannelDirectTcpip.java     |  2 +-
 .../java/org/apache/sshd/common/channel/AbstractChannel.java   |  4 ++--
 .../org/apache/sshd/common/channel/BufferedIoOutputStream.java |  3 ++-
 .../src/main/java/org/apache/sshd/common/channel/Channel.java  |  6 +-----
 .../java/org/apache/sshd/common/channel/ChannelIdentifier.java | 10 +++++++---
 .../org/apache/sshd/common/channel/ChannelOutputStream.java    |  4 ++--
 .../sshd/common/channel/exception/SshChannelException.java     |  5 ++++-
 .../org/apache/sshd/common/forward/TcpipClientChannel.java     |  2 +-
 .../sshd/common/session/helpers/AbstractConnectionService.java |  4 ++--
 .../org/apache/sshd/server/forward/TcpipServerChannel.java     |  6 +++---
 .../java/org/apache/sshd/server/x11/ChannelForwardedX11.java   |  2 +-
 sshd-core/src/test/java/org/apache/sshd/client/ClientTest.java |  6 +++---
 .../test/java/org/apache/sshd/common/channel/WindowTest.java   |  2 +-
 .../java/org/apache/sshd/util/test/AsyncEchoShellFactory.java  |  2 +-
 .../java/org/apache/sshd/sftp/client/impl/SftpPathImpl.java    | 10 +++++-----
 .../apache/sshd/sftp/common/extensions/SupportedParser.java    |  7 +++----
 .../main/java/org/apache/sshd/sftp/server/SftpSubsystem.java   |  2 +-
 .../src/test/java/org/apache/sshd/sftp/client/ClientTest.java  |  4 ++--
 22 files changed, 47 insertions(+), 43 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 08c9d71..9fc8652 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -39,7 +39,7 @@ this value (though the choice of 256KB should be compatible with the vast majori
 ### SSH channel identifiers have been changed to use *long* instead of *int* in order to align them with the standard that required them to be *UINT32* values.
 
 The relevant API(s) have been modified accordingly - which may cause a few incompatibility issues with code that extends/implements existing `Channel` classes
-and interfaces.
+and interfaces. In this context, the *Channel* interface now extends *ChannelIdentifier* where *getId()* has been renamed to *getChannelId()*
 
 ### *long* used instead of *int* in most encoded/decoded packets that are specified as being *UINT32*
 
diff --git a/sshd-common/src/main/java/org/apache/sshd/common/session/SessionContextHolder.java b/sshd-common/src/main/java/org/apache/sshd/common/session/SessionContextHolder.java
index 79edb7e..c72aa66 100644
--- a/sshd-common/src/main/java/org/apache/sshd/common/session/SessionContextHolder.java
+++ b/sshd-common/src/main/java/org/apache/sshd/common/session/SessionContextHolder.java
@@ -22,6 +22,7 @@ package org.apache.sshd.common.session;
 /**
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
+@FunctionalInterface
 public interface SessionContextHolder {
     SessionContext getSessionContext();
 }
diff --git a/sshd-contrib/src/main/java/org/apache/sshd/contrib/common/session/helpers/ChannelIdTrackingUnknownChannelReferenceHandler.java b/sshd-contrib/src/main/java/org/apache/sshd/contrib/common/session/helpers/ChannelIdTrackingUnknownChannelReferenceHandler.java
index 7d282b9..5686a29 100644
--- a/sshd-contrib/src/main/java/org/apache/sshd/contrib/common/session/helpers/ChannelIdTrackingUnknownChannelReferenceHandler.java
+++ b/sshd-contrib/src/main/java/org/apache/sshd/contrib/common/session/helpers/ChannelIdTrackingUnknownChannelReferenceHandler.java
@@ -52,7 +52,7 @@ public class ChannelIdTrackingUnknownChannelReferenceHandler
 
     @Override
     public void channelInitialized(Channel channel) {
-        long channelId = channel.getId();
+        long channelId = channel.getChannelId();
         Session session = channel.getSession();
         Long lastTracked = session.setAttribute(LAST_CHANNEL_ID_KEY, channelId);
         if (log.isDebugEnabled()) {
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
index 4124408..1f6f569 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
@@ -329,7 +329,7 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C
         Window wLocal = getLocalWindow();
         Buffer buffer = session.createBuffer(SshConstants.SSH_MSG_CHANNEL_OPEN, type.length() + Integer.SIZE);
         buffer.putString(type);
-        buffer.putUInt(getId());
+        buffer.putUInt(getChannelId());
         buffer.putUInt(wLocal.getSize());
         buffer.putUInt(wLocal.getPacketSize());
         writePacket(buffer);
@@ -385,7 +385,7 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C
         this.openFailureReason = reason;
         this.openFailureMsg = msg;
         this.openFailureLang = lang;
-        this.openFuture.setException(new SshChannelOpenException(getId(), reason, msg));
+        this.openFuture.setException(new SshChannelOpenException(getChannelId(), reason, msg));
         this.closeFuture.setClosed();
         this.doCloseImmediately();
         notifyStateChanged("SSH_MSG_CHANNEL_OPEN_FAILURE");
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelDirectTcpip.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelDirectTcpip.java
index b8b2ab8..aecdb2d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelDirectTcpip.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelDirectTcpip.java
@@ -84,7 +84,7 @@ public class ChannelDirectTcpip extends AbstractClientChannel {
         Buffer buffer = session.createBuffer(SshConstants.SSH_MSG_CHANNEL_OPEN,
                 type.length() + remoteName.length() + localName.length() + Long.SIZE);
         buffer.putString(type);
-        buffer.putUInt(getId());
+        buffer.putUInt(getChannelId());
         buffer.putUInt(wLocal.getSize());
         buffer.putUInt(wLocal.getPacketSize());
         buffer.putString(remoteName);
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 3ee3fd2..ac2ac68 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
@@ -155,7 +155,7 @@ public abstract class AbstractChannel extends AbstractInnerCloseable implements
     }
 
     @Override
-    public long getId() {
+    public long getChannelId() {
         return id;
     }
 
@@ -1019,7 +1019,7 @@ public abstract class AbstractChannel extends AbstractInnerCloseable implements
 
     @Override
     public String toString() {
-        return getClass().getSimpleName() + "[id=" + getId() + ", recipient=" + getRecipient() + "]" + "-"
+        return getClass().getSimpleName() + "[id=" + getChannelId() + ", recipient=" + getRecipient() + "]" + "-"
                + getSession();
     }
 }
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/BufferedIoOutputStream.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/BufferedIoOutputStream.java
index 15cee93..ad83c67 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/BufferedIoOutputStream.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/BufferedIoOutputStream.java
@@ -43,7 +43,7 @@ import org.apache.sshd.core.CoreModuleProperties;
 /**
  * An {@link IoOutputStream} capable of queuing write requests.
  */
-public class BufferedIoOutputStream extends AbstractInnerCloseable implements IoOutputStream {
+public class BufferedIoOutputStream extends AbstractInnerCloseable implements IoOutputStream, ChannelIdentifier {
     protected final Object id;
     protected final long channelId;
     protected final int maxPendingBytesCount;
@@ -71,6 +71,7 @@ public class BufferedIoOutputStream extends AbstractInnerCloseable implements Io
         this.maxWaitForPendingWrites = Objects.requireNonNull(maxWaitForPendingWrites, "No max. pending time value provided");
     }
 
+    @Override
     public long getChannelId() {
         return channelId;
     }
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 41a86be..b2106aa 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
@@ -44,6 +44,7 @@ import org.apache.sshd.common.util.buffer.Buffer;
  */
 public interface Channel
         extends SessionHolder<Session>,
+        ChannelIdentifier,
         ChannelListenerManager,
         PropertyResolver,
         AttributeStore,
@@ -55,11 +56,6 @@ public interface Channel
     String CHANNEL_SUBSYSTEM = "subsystem";
 
     /**
-     * @return Local channel UINT32 identifier
-     */
-    long getId();
-
-    /**
      * @return Remote channel UITN32 identifier
      */
     long getRecipient();
diff --git a/sshd-common/src/main/java/org/apache/sshd/common/session/SessionContextHolder.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelIdentifier.java
similarity index 82%
copy from sshd-common/src/main/java/org/apache/sshd/common/session/SessionContextHolder.java
copy to sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelIdentifier.java
index 79edb7e..092a566 100644
--- a/sshd-common/src/main/java/org/apache/sshd/common/session/SessionContextHolder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelIdentifier.java
@@ -17,11 +17,15 @@
  * under the License.
  */
 
-package org.apache.sshd.common.session;
+package org.apache.sshd.common.channel;
 
 /**
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
-public interface SessionContextHolder {
-    SessionContext getSessionContext();
+@FunctionalInterface
+public interface ChannelIdentifier {
+    /**
+     * @return Local channel UINT32 identifier
+     */
+    long getChannelId();
 }
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelOutputStream.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelOutputStream.java
index 188fb78..7dda557 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelOutputStream.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/ChannelOutputStream.java
@@ -129,7 +129,7 @@ public class ChannelOutputStream extends OutputStream implements java.nio.channe
         Channel channel = getChannel();
         if (!isOpen()) {
             throw new SshChannelClosedException(
-                    channel.getId(),
+                    channel.getChannelId(),
                     "write(" + this + ") len=" + l + " - channel already closed");
         }
 
@@ -196,7 +196,7 @@ public class ChannelOutputStream extends OutputStream implements java.nio.channe
         Channel channel = getChannel();
         if (!isOpen()) {
             throw new SshChannelClosedException(
-                    channel.getId(),
+                    channel.getChannelId(),
                     "flush(" + this + ") length=" + bufferLength + " - stream is already closed");
         }
 
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/exception/SshChannelException.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/exception/SshChannelException.java
index 13d9f6e..27b2799 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/exception/SshChannelException.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/exception/SshChannelException.java
@@ -21,10 +21,12 @@ package org.apache.sshd.common.channel.exception;
 
 import java.io.IOException;
 
+import org.apache.sshd.common.channel.ChannelIdentifier;
+
 /**
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
-public abstract class SshChannelException extends IOException {
+public abstract class SshChannelException extends IOException implements ChannelIdentifier {
     private static final long serialVersionUID = 7355720478400167933L;
 
     private final long channelId;
@@ -42,6 +44,7 @@ public abstract class SshChannelException extends IOException {
         this.channelId = channelId;
     }
 
+    @Override
     public long getChannelId() {
         return channelId;
     }
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/forward/TcpipClientChannel.java b/sshd-core/src/main/java/org/apache/sshd/common/forward/TcpipClientChannel.java
index 17c6003..cdcbc6f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/forward/TcpipClientChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/forward/TcpipClientChannel.java
@@ -150,7 +150,7 @@ public class TcpipClientChannel extends AbstractClientChannel implements Forward
         Buffer buffer = session.createBuffer(SshConstants.SSH_MSG_CHANNEL_OPEN,
                 type.length() + srcHost.length() + dstHost.length() + Long.SIZE);
         buffer.putString(type);
-        buffer.putUInt(getId());
+        buffer.putUInt(getChannelId());
         buffer.putUInt(wLocal.getSize());
         buffer.putUInt(wLocal.getPacketSize());
         buffer.putString(dstHost);
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
index d390fd5..18c7181 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
@@ -430,7 +430,7 @@ public abstract class AbstractConnectionService
      */
     @Override
     public void unregisterChannel(Channel channel) {
-        long channelId = channel.getId();
+        long channelId = channel.getChannelId();
         Channel result;
         synchronized (channels) {
             result = channels.remove(channelId);
@@ -550,7 +550,7 @@ public abstract class AbstractConnectionService
             return; // debug breakpoint
         }
 
-        long id = channel.getId();
+        long id = channel.getChannelId();
         boolean debugEnabled = log.isDebugEnabled();
         if (debugEnabled) {
             log.debug("channelOpenFailure({}) Received SSH_MSG_CHANNEL_OPEN_FAILURE", channel);
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 2a14a35..db22a51 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
@@ -201,7 +201,7 @@ public class TcpipServerChannel extends AbstractServerChannel implements Streami
                 }
                 try {
                     f.setException(new SshChannelOpenException(
-                            getId(),
+                            getChannelId(),
                             SshConstants.SSH_OPEN_ADMINISTRATIVELY_PROHIBITED, "Connection denied"));
                 } finally {
                     super.close(true);
@@ -215,7 +215,7 @@ public class TcpipServerChannel extends AbstractServerChannel implements Streami
         }
 
         if (streaming == Streaming.Async) {
-            long channelId = getId();
+            long channelId = getChannelId();
             out = new BufferedIoOutputStream(
                     "aysnc-tcpip-channel@" + channelId, channelId,
                     new ChannelAsyncOutputStream(this, SshConstants.SSH_MSG_CHANNEL_DATA) {
@@ -343,7 +343,7 @@ public class TcpipServerChannel extends AbstractServerChannel implements Streami
         try {
             if (problem instanceof ConnectException) {
                 f.setException(new SshChannelOpenException(
-                        getId(), SshConstants.SSH_OPEN_CONNECT_FAILED, problem.getMessage(), problem));
+                        getChannelId(), SshConstants.SSH_OPEN_CONNECT_FAILED, problem.getMessage(), problem));
             } else {
                 f.setException(problem);
             }
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/x11/ChannelForwardedX11.java b/sshd-core/src/main/java/org/apache/sshd/server/x11/ChannelForwardedX11.java
index cde200b..2781c38 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/x11/ChannelForwardedX11.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/x11/ChannelForwardedX11.java
@@ -67,7 +67,7 @@ public class ChannelForwardedX11 extends AbstractClientChannel {
         Buffer buffer = session.createBuffer(SshConstants.SSH_MSG_CHANNEL_OPEN,
                 remoteHost.length() + type.length() + Integer.SIZE);
         buffer.putString(type);
-        buffer.putUInt(getId());
+        buffer.putUInt(getChannelId());
         buffer.putUInt(wLocal.getSize());
         buffer.putUInt(wLocal.getPacketSize());
         buffer.putString(remoteHost);
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 bc466e2..ad40b46 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
@@ -219,7 +219,7 @@ public class ClientTest extends BaseTestSupport {
 
                             @Override
                             public String toString() {
-                                return "ChannelSession" + "[id=" + getId() + ", recipient=" + getRecipient() + "]";
+                                return "ChannelSession" + "[id=" + getChannelId() + ", recipient=" + getRecipient() + "]";
                             }
                         };
                     }
@@ -377,7 +377,7 @@ public class ClientTest extends BaseTestSupport {
             }
 
             private void handleChannelEvent(String name, Channel channel) {
-                long id = channel.getId();
+                long id = channel.getChannelId();
                 synchronized (eventsMap) {
                     if (eventsMap.put(name, id) != null) {
                         return; // already generated an exception for this event
@@ -1477,7 +1477,7 @@ public class ClientTest extends BaseTestSupport {
 
             Set<Long> ids = new HashSet<>(channels.size());
             for (ClientChannel c : channels) {
-                long id = c.getId();
+                long id = c.getChannelId();
                 assertTrue("Channel ID repeated: " + id, ids.add(id));
             }
         } finally {
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 77965f2..a4817fd 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
@@ -121,7 +121,7 @@ public class WindowTest extends BaseTestSupport {
 
                             @Override
                             public String toString() {
-                                return "ChannelSession" + "[id=" + getId() + ", recipient=" + getRecipient() + "]";
+                                return "ChannelSession" + "[id=" + getChannelId() + ", recipient=" + getRecipient() + "]";
                             }
                         };
                     }
diff --git a/sshd-core/src/test/java/org/apache/sshd/util/test/AsyncEchoShellFactory.java b/sshd-core/src/test/java/org/apache/sshd/util/test/AsyncEchoShellFactory.java
index 22f7fec..9a45920 100644
--- a/sshd-core/src/test/java/org/apache/sshd/util/test/AsyncEchoShellFactory.java
+++ b/sshd-core/src/test/java/org/apache/sshd/util/test/AsyncEchoShellFactory.java
@@ -112,7 +112,7 @@ public class AsyncEchoShellFactory implements ShellFactory {
                 return (BufferedIoOutputStream) stream;
             }
 
-            long channelId = session.getId();
+            long channelId = session.getChannelId();
             return new BufferedIoOutputStream(prefix + "@" + channelId, channelId, stream, session);
         }
 
diff --git a/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/impl/SftpPathImpl.java b/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/impl/SftpPathImpl.java
index d9d76cc..fa27fe2 100644
--- a/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/impl/SftpPathImpl.java
+++ b/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/impl/SftpPathImpl.java
@@ -28,7 +28,7 @@ import org.apache.sshd.sftp.client.fs.SftpFileSystem;
 import org.apache.sshd.sftp.client.fs.SftpPath;
 
 /**
- * An {@link SftpPath} that can cache {@link SftpClient.Attributes}.
+ * An {@link SftpPath} that can cache {@code SftpClient.Attributes}.
  */
 public class SftpPathImpl extends SftpPath {
 
@@ -41,7 +41,7 @@ public class SftpPathImpl extends SftpPath {
     }
 
     /**
-     * {@link SftpPath} instances can cache SFTP {@link SftpClient.Attributes}. Caching can be enabled by passing
+     * {@link SftpPath} instances can cache SFTP {@code SftpClient.Attributes}. Caching can be enabled by passing
      * {@code true}. If the {@link SftpPath} instance is already caching attributes, a counter is increased only. To
      * disable caching, pass {@code false}, which decreases the counter. The cache is cleared when the counter reaches
      * zero again.
@@ -81,7 +81,7 @@ public class SftpPathImpl extends SftpPath {
      * Sets the cached attributes to the argument if this {@link SftpPath} instance is currently caching attributes.
      * Otherwise a no-op.
      *
-     * @param attributes the {@link SftpClient.Attributes} to cache
+     * @param attributes the {@code SftpClient.Attributes} to cache
      */
     public void cacheAttributes(SftpClient.Attributes attributes) {
         if (cachingLevel > 0) {
@@ -92,7 +92,7 @@ public class SftpPathImpl extends SftpPath {
     /**
      * Unconditionally set the cached attributes, whether or not this instance's attribute cache is enabled.
      *
-     * @param attributes the {@link SftpClient.Attributes} to cache
+     * @param attributes the {@code SftpClient.Attributes} to cache
      */
     public void setAttributes(SftpClient.Attributes attributes) {
         this.attributes = attributes;
@@ -104,7 +104,7 @@ public class SftpPathImpl extends SftpPath {
     }
 
     /**
-     * Performs the given operation with attribute caching. If {@link SftpClient.Attributes} are fetched by the
+     * Performs the given operation with attribute caching. If {@code SftpClient.Attributes} are fetched by the
      * operation, they will be cached and subsequently these cached attributes will be re-used for this {@link SftpPath}
      * instance throughout the operation. Calls to {@link #withAttributeCache(IOFunction)} may be nested. The cache is
      * cleared at the start and at the end of the outermost invocation.
diff --git a/sshd-sftp/src/main/java/org/apache/sshd/sftp/common/extensions/SupportedParser.java b/sshd-sftp/src/main/java/org/apache/sshd/sftp/common/extensions/SupportedParser.java
index 28ebe4b..193dd7a 100644
--- a/sshd-sftp/src/main/java/org/apache/sshd/sftp/common/extensions/SupportedParser.java
+++ b/sshd-sftp/src/main/java/org/apache/sshd/sftp/common/extensions/SupportedParser.java
@@ -28,16 +28,15 @@ import org.apache.sshd.sftp.common.extensions.SupportedParser.Supported;
 
 /**
  * Parses the &quot;supported&quot; extension as defined in
- * <A HREF="http://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/draft-ietf-secsh-filexfer-05.txt">DRAFT 05 -
- * section 4.4</A>
+ * <A HREF="https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-05#section-4.4">DRAFT 05 - section 4.4</A>
  *
  * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
  */
 public class SupportedParser extends AbstractParser<Supported> {
     /**
      * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
-     * @see    <A HREF="http://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/draft-ietf-secsh-filexfer-05">DRAFT 05
-     *         - section 4.4</A>
+     * @see    <A HREF="https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-05#section-4.4">DRAFT 05 -
+     *         section 4.4</A>
      */
     public static class Supported {
         // CHECKSTYLE:OFF
diff --git a/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java b/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java
index ae48894..00e1c59 100644
--- a/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java
+++ b/sshd-sftp/src/main/java/org/apache/sshd/sftp/server/SftpSubsystem.java
@@ -241,7 +241,7 @@ public class SftpSubsystem
     @Override
     public void setIoOutputStream(IoOutputStream out) {
         ChannelSession channel = getServerChannelSession();
-        long channelId = channel.getId();
+        long channelId = channel.getChannelId();
         this.out = new BufferedIoOutputStream("sftp-out@" + channelId, channelId, out, channel);
     }
 
diff --git a/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/ClientTest.java b/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/ClientTest.java
index b2c3dad..5b01a18 100644
--- a/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/ClientTest.java
+++ b/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/ClientTest.java
@@ -158,7 +158,7 @@ public class ClientTest extends BaseTestSupport {
 
                             @Override
                             public String toString() {
-                                return "ChannelSession" + "[id=" + getId() + ", recipient=" + getRecipient() + "]";
+                                return "ChannelSession" + "[id=" + getChannelId() + ", recipient=" + getRecipient() + "]";
                             }
                         };
                     }
@@ -280,7 +280,7 @@ public class ClientTest extends BaseTestSupport {
 
             Set<Long> ids = new HashSet<>(channels.size());
             for (ClientChannel c : channels) {
-                long id = c.getId();
+                long id = c.getChannelId();
                 assertTrue("Channel ID repeated: " + id, ids.add(id));
             }
         } finally {