This is an automated email from the ASF dual-hosted git repository. twolf pushed a commit to branch dev_3.0 in repository https://gitbox.apache.org/repos/asf/mina-sshd.git
commit 8ac246398b34f143edcde2316eb8d7c56cdafeda Author: Thomas Wolf <tw...@apache.org> AuthorDate: Fri Apr 25 19:24:13 2025 +0200 Remove unused deprecated items --- .../apache/sshd/common/util/ReflectionUtils.java | 20 -------------------- .../sshd/common/util/security/SecurityUtils.java | 18 ------------------ .../BouncyCastleSecurityProviderRegistrar.java | 10 ---------- .../eddsa/EdDSASecurityProviderRegistrar.java | 7 +------ .../sshd/common/channel/AbstractChannel.java | 22 ++++------------------ .../fs/SftpFileSystemClientSessionInitializer.java | 22 ---------------------- 6 files changed, 5 insertions(+), 94 deletions(-) diff --git a/sshd-common/src/main/java/org/apache/sshd/common/util/ReflectionUtils.java b/sshd-common/src/main/java/org/apache/sshd/common/util/ReflectionUtils.java index 36740c26f..a7f76c3bc 100644 --- a/sshd-common/src/main/java/org/apache/sshd/common/util/ReflectionUtils.java +++ b/sshd-common/src/main/java/org/apache/sshd/common/util/ReflectionUtils.java @@ -43,26 +43,6 @@ public final class ReflectionUtils { return GenericUtils.selectMatchingMembers(acceptor, clazz.getDeclaredFields()); } - /** - * Checks whether a given {@link ClassLoader} can load a class. - * - * @param cl {@link ClassLoader} to use - * @param className to check - * @return {@code true} if the class loader can load the class, {@code false} otherwise - * @deprecated The preferred method is - * {@link org.apache.sshd.common.util.threads.ThreadUtils#resolveDefaultClass(Class, String)} - * which checks all possible ClassLoaders. - */ - @Deprecated - public static boolean isClassAvailable(ClassLoader cl, String className) { - try { - cl.loadClass(className); - return true; - } catch (Throwable ignored) { - return false; - } - } - public static Object newInstance(Class<?> clazz) throws ReflectiveOperationException { return newInstance(clazz, Object.class); } diff --git a/sshd-common/src/main/java/org/apache/sshd/common/util/security/SecurityUtils.java b/sshd-common/src/main/java/org/apache/sshd/common/util/security/SecurityUtils.java index 97fabfdb5..e524dabc3 100644 --- a/sshd-common/src/main/java/org/apache/sshd/common/util/security/SecurityUtils.java +++ b/sshd-common/src/main/java/org/apache/sshd/common/util/security/SecurityUtils.java @@ -141,14 +141,6 @@ public final class SecurityUtils { "org.apache.sshd.common.util.security.bouncycastle.BouncyCastleSecurityProviderRegistrar", "org.apache.sshd.common.util.security.eddsa.EdDSASecurityProviderRegistrar")); - /** - * System property used to control whether to automatically register the {@code Bouncyastle} JCE provider - * - * @deprecated Please use "org.apache.sshd.security.provider.BC.enabled" - */ - @Deprecated - public static final String REGISTER_BOUNCY_CASTLE_PROP = "org.apache.sshd.registerBouncyCastle"; - /** * System property used to control whether Elliptic Curves are supported or not. If not set then the support is * auto-detected. <B>Note:</B> if set to {@code true} it is up to the user to make sure that indeed there is a @@ -156,16 +148,6 @@ public final class SecurityUtils { */ public static final String ECC_SUPPORTED_PROP = "org.apache.sshd.eccSupport"; - /** - * System property used to decide whether EDDSA curves are supported or not (in addition or even in spite of - * {@link #isEDDSACurveSupported()}). If not set or set to {@code true}, then the existence of the optional support - * classes determines the support. - * - * @deprecated Please use "org.apache.sshd.security.provider.EdDSA.enabled&qupt; - */ - @Deprecated - public static final String EDDSA_SUPPORTED_PROP = "org.apache.sshd.eddsaSupport"; - public static final String PROP_DEFAULT_SECURITY_PROVIDER = "org.apache.sshd.security.defaultProvider"; /** diff --git a/sshd-common/src/main/java/org/apache/sshd/common/util/security/bouncycastle/BouncyCastleSecurityProviderRegistrar.java b/sshd-common/src/main/java/org/apache/sshd/common/util/security/bouncycastle/BouncyCastleSecurityProviderRegistrar.java index 8a3830bcb..f79991e02 100644 --- a/sshd-common/src/main/java/org/apache/sshd/common/util/security/bouncycastle/BouncyCastleSecurityProviderRegistrar.java +++ b/sshd-common/src/main/java/org/apache/sshd/common/util/security/bouncycastle/BouncyCastleSecurityProviderRegistrar.java @@ -59,16 +59,6 @@ public class BouncyCastleSecurityProviderRegistrar extends AbstractSecurityProvi super(SecurityUtils.BOUNCY_CASTLE); } - @Override - public boolean isEnabled() { - if (!super.isEnabled()) { - return false; - } - - // For backward compatibility - return this.getBooleanProperty(SecurityUtils.REGISTER_BOUNCY_CASTLE_PROP, true); - } - @Override public String getProviderName() { return providerName; diff --git a/sshd-common/src/main/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderRegistrar.java b/sshd-common/src/main/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderRegistrar.java index edcb55bf0..7233495b8 100644 --- a/sshd-common/src/main/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderRegistrar.java +++ b/sshd-common/src/main/java/org/apache/sshd/common/util/security/eddsa/EdDSASecurityProviderRegistrar.java @@ -46,12 +46,7 @@ public class EdDSASecurityProviderRegistrar extends AbstractSecurityProviderRegi @Override public boolean isEnabled() { - if (SecurityUtils.isFipsMode() || !super.isEnabled()) { - return false; - } - - // For backward compatibility - return this.getBooleanProperty(SecurityUtils.EDDSA_SUPPORTED_PROP, true); + return !SecurityUtils.isFipsMode() && super.isEnabled(); } @Override 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 f96327397..4df988c34 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 @@ -49,6 +49,7 @@ import org.apache.sshd.common.future.CloseFuture; import org.apache.sshd.common.future.DefaultCloseFuture; import org.apache.sshd.common.future.SshFutureListener; import org.apache.sshd.common.io.AbstractIoWriteFuture; +import org.apache.sshd.common.io.DefaultIoWriteFuture; import org.apache.sshd.common.io.IoWriteFuture; import org.apache.sshd.common.session.ConnectionService; import org.apache.sshd.common.session.Session; @@ -102,15 +103,6 @@ public abstract class AbstractChannel extends AbstractInnerCloseable implements protected final AtomicBoolean initialized = new AtomicBoolean(false); protected final AtomicBoolean eofReceived = new AtomicBoolean(false); - /** - * Obsolete and unused; present only for API backwards compatibility. Use {@link #isEofSent()} to determine whether - * EOF is already sent on this channel, and {@link #sendEof()} to send EOF. The latter will return {@code null} if - * EOF already was sent. - * - * @deprecated since 2.10.1 - */ - @Deprecated - protected final AtomicBoolean eofSent = new AtomicBoolean(false); protected final AtomicBoolean unregisterSignaled = new AtomicBoolean(false); protected final AtomicBoolean closeSignaled = new AtomicBoolean(false); protected AtomicReference<GracefulState> gracefulState = new AtomicReference<>(GracefulState.Opened); @@ -555,11 +547,8 @@ public abstract class AbstractChannel extends AbstractInnerCloseable implements try { IoWriteFuture eofPrevention = AbstractIoWriteFuture.fulfilled(getChannelId(), futureLock); - if (eofFuture.compareAndSet(null, eofPrevention)) { - if (debugEnabled) { - log.debug("handleClose({}) prevent sending EOF", this); - } - eofSent.set(true); // Just for API backwards compatibility + if (eofFuture.compareAndSet(null, eofPrevention) && debugEnabled) { + log.debug("handleClose({}) prevent sending EOF", this); } if (gracefulState.compareAndSet(GracefulState.Opened, GracefulState.CloseReceived)) { @@ -967,16 +956,13 @@ public abstract class AbstractChannel extends AbstractInnerCloseable implements return null; } - AbstractIoWriteFuture eofWritten = new AbstractIoWriteFuture(getChannelId(), futureLock) { - // Nothin extra - }; + DefaultIoWriteFuture eofWritten = new DefaultIoWriteFuture(getChannelId(), futureLock); if (!eofFuture.compareAndSet(null, eofWritten)) { if (log.isDebugEnabled()) { log.debug("sendEof({}) already sent (state={})", this, channelState); } return null; } - eofSent.set(true);// Just for API backwards compatibility if (log.isDebugEnabled()) { log.debug("sendEof({}) SSH_MSG_CHANNEL_EOF (state={})", this, channelState); diff --git a/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/fs/SftpFileSystemClientSessionInitializer.java b/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/fs/SftpFileSystemClientSessionInitializer.java index c7e70d7bb..f810de5fe 100644 --- a/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/fs/SftpFileSystemClientSessionInitializer.java +++ b/sshd-sftp/src/main/java/org/apache/sshd/sftp/client/fs/SftpFileSystemClientSessionInitializer.java @@ -90,28 +90,6 @@ public interface SftpFileSystemClientSessionInitializer { session.setSessionHeartbeat(SessionHeartbeatController.HeartbeatType.IGNORE, Duration.ofSeconds(10)); } - /** - * Invoked by the {@link SftpFileSystemProvider#newFileSystem(java.net.URI, Map)} method in order to create the - * {@link SftpFileSystem} once session has been authenticated. - * - * @param provider The {@link SftpFileSystemProvider} instance requesting the session - * @param context The initialization {@link SftpFileSystemInitializationContext} - * @param session The authenticated {@link ClientSession} - * @param selector The <U>resolved</U> {@link SftpVersionSelector} to use - * @param errorDataHandler The {@link SftpErrorDataHandler} to handle incoming data through the error stream - - * if {@code null} the data is silently ignored - * @return The created {@link SftpFileSystem} - * @throws IOException If failed to create the file-system - * @deprecated since 2.10.1 - */ - @Deprecated - default SftpFileSystem createSftpFileSystem( - SftpFileSystemProvider provider, SftpFileSystemInitializationContext context, ClientSession session, - SftpVersionSelector selector, SftpErrorDataHandler errorDataHandler) - throws IOException { - return createSftpFileSystem(provider, context, x -> session, selector, errorDataHandler); - } - /** * Invoked by the {@link SftpFileSystemProvider#newFileSystem(java.net.URI, Map)} method in order to create the * {@link SftpFileSystem} once session has been authenticated.