You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/01/10 14:40:17 UTC

(commons-net) branch master updated (f3d613a7 -> 3df1808f)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git


    from f3d613a7 Bump version
     new a88253e3 Sort members
     new 3df1808f Use final but not when redundant

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/commons/net/ftp/FTPSClient.java     | 142 ++++++++++-----------
 .../apache/commons/net/util/KeyManagerUtils.java   |   6 +-
 .../commons/net/ftp/FTPSClientGettersTest.java     |   8 +-
 .../commons/net/tftp/TFTPServerPathTest.java       |   4 +-
 4 files changed, 80 insertions(+), 80 deletions(-)


(commons-net) 02/02: Use final but not when redundant

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git

commit 3df1808f85495407251a0228f4962f4e9d666e67
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Jan 10 09:40:12 2024 -0500

    Use final but not when redundant
---
 src/main/java/org/apache/commons/net/util/KeyManagerUtils.java    | 6 +++---
 .../java/org/apache/commons/net/ftp/FTPSClientGettersTest.java    | 8 ++++----
 src/test/java/org/apache/commons/net/tftp/TFTPServerPathTest.java | 4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/util/KeyManagerUtils.java b/src/main/java/org/apache/commons/net/util/KeyManagerUtils.java
index fe0e6493..5b240507 100644
--- a/src/main/java/org/apache/commons/net/util/KeyManagerUtils.java
+++ b/src/main/java/org/apache/commons/net/util/KeyManagerUtils.java
@@ -80,15 +80,15 @@ public final class KeyManagerUtils {
             this.certChain = x509certs;
         }
 
-        final String getAlias() {
+        String getAlias() {
             return this.keyAlias;
         }
 
-        final X509Certificate[] getCertificateChain() {
+        X509Certificate[] getCertificateChain() {
             return this.certChain;
         }
 
-        final PrivateKey getPrivateKey() {
+        PrivateKey getPrivateKey() {
             return this.key;
         }
     }
diff --git a/src/test/java/org/apache/commons/net/ftp/FTPSClientGettersTest.java b/src/test/java/org/apache/commons/net/ftp/FTPSClientGettersTest.java
index ba8cf5d8..cd980784 100644
--- a/src/test/java/org/apache/commons/net/ftp/FTPSClientGettersTest.java
+++ b/src/test/java/org/apache/commons/net/ftp/FTPSClientGettersTest.java
@@ -30,14 +30,14 @@ public class FTPSClientGettersTest {
 
     @Test
     public void testGetters() {
-        FTPSClient testClient = new FTPSClient("SSL", true);
+        final FTPSClient testClient = new FTPSClient("SSL", true);
         assertTrue(testClient.isImplicit());
         assertEquals("SSL", testClient.getProtocol());
 
-        FTPSClient testClient2 = new FTPSClient("TLS", false);
+        final FTPSClient testClient2 = new FTPSClient("TLS", false);
         assertFalse(testClient2.isImplicit());
         assertEquals("TLS", testClient2.getProtocol());
-        final String[] protocols = new String[]{"123", "456"};
+        final String[] protocols = {"123", "456"};
         testClient2.setEnabledProtocols(protocols);
         assertArrayEquals(protocols, testClient2.getProtocols());
         testClient2.setNeedClientAuth(true);
@@ -48,7 +48,7 @@ public class FTPSClientGettersTest {
         assertTrue(testClient2.isWantClientAuth());
         testClient2.setWantClientAuth(false);
         assertFalse(testClient2.isWantClientAuth());
-        final String[] suites = new String[]{"abc", "def"};
+        final String[] suites = {"abc", "def"};
         testClient2.setEnabledCipherSuites(suites);
         assertArrayEquals(suites, testClient2.getSuites());
         testClient2.setAuthValue("qwerty");
diff --git a/src/test/java/org/apache/commons/net/tftp/TFTPServerPathTest.java b/src/test/java/org/apache/commons/net/tftp/TFTPServerPathTest.java
index 8cae5989..b7faef3e 100644
--- a/src/test/java/org/apache/commons/net/tftp/TFTPServerPathTest.java
+++ b/src/test/java/org/apache/commons/net/tftp/TFTPServerPathTest.java
@@ -57,11 +57,11 @@ public class TFTPServerPathTest {
         if (path != null) {
             try {
                 Files.deleteIfExists(path);
-            } catch (IOException e) {
+            } catch (final IOException e) {
                 if (retry) {
                     try {
                         Thread.sleep(500);
-                    } catch (InterruptedException e1) {
+                    } catch (final InterruptedException e1) {
                         fail(e);
                     }
                     Files.deleteIfExists(path);


(commons-net) 01/02: Sort members

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git

commit a88253e3dfbac5187060537c1139e253bc7a8913
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Jan 10 09:36:20 2024 -0500

    Sort members
---
 .../org/apache/commons/net/ftp/FTPSClient.java     | 142 ++++++++++-----------
 1 file changed, 71 insertions(+), 71 deletions(-)

diff --git a/src/main/java/org/apache/commons/net/ftp/FTPSClient.java b/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
index 380ba80d..43fa1e32 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
@@ -638,6 +638,32 @@ public class FTPSClient extends FTPClient {
         return false;
     }
 
+    /**
+     * Gets the secure socket protocol to be used, e.g. SSL/TLS.
+     * @since 3.11.0
+     */
+    protected String getProtocol() {
+        return protocol;
+    }
+
+    /**
+     * Gets the protocol versions. The {@link #getEnabledProtocols()} method gets the value from the socket while
+     * this method gets its value from this instance's config.
+     * @since 3.11.0
+     */
+    protected String[] getProtocols() {
+        return protocols == null ? null : protocols.clone();
+    }
+
+    /**
+     * Gets the cipher suites. The {@link #getEnabledCipherSuites()} method gets the value from the socket while
+     * this method gets its value from this instance's config.
+     * @since 3.11.0
+     */
+    protected String[] getSuites() {
+        return suites == null ? null : suites.clone();
+    }
+
     /**
      * Gets the currently configured {@link TrustManager}.
      *
@@ -683,6 +709,23 @@ public class FTPSClient extends FTPClient {
         }
     }
 
+    /**
+     * Gets the use client mode flag. The {@link #getUseClientMode()} method gets the value from the socket while
+     * this method gets its value from this instance's config.
+     * @since 3.11.0
+     */
+    protected boolean isClientMode() {
+        return isClientMode;
+    }
+
+    /**
+     * Gets whether a new SSL session may be established by this socket. Default true
+     * @since 3.11.0
+     */
+    protected boolean isCreation() {
+        return isCreation;
+    }
+
     /**
      * Return whether or not endpoint identification using the HTTPS algorithm on Java 1.7+ is enabled. The default behavior is for this to be disabled.
      *
@@ -695,6 +738,32 @@ public class FTPSClient extends FTPClient {
         return tlsEndpointChecking;
     }
 
+    /**
+     * Gets the security mode. (True - Implicit Mode / False - Explicit Mode)
+     * @since 3.11.0
+     */
+    protected boolean isImplicit() {
+        return isImplicit;
+    }
+
+    /**
+     * Gets the need client auth flag. The {@link #getNeedClientAuth()} method gets the value from the socket while
+     * this method gets its value from this instance's config.
+     * @since 3.11.0
+     */
+    protected boolean isNeedClientAuth() {
+        return isNeedClientAuth;
+    }
+
+    /**
+     * Gets the want client auth flag. The {@link #getWantClientAuth()} method gets the value from the socket while
+     * this method gets its value from this instance's config.
+     * @since 3.11.0
+     */
+    protected boolean isWantClientAuth() {
+        return isWantClientAuth;
+    }
+
     /**
      * Establishes a data connection with the FTP server, returning a Socket for the connection if successful. If a restart offset has been set with
      * {@link #setRestartOffset(long)}, a REST command is issued to the server with the offset as an argument before establishing the data connection. Active
@@ -878,6 +947,8 @@ public class FTPSClient extends FTPClient {
         return minvalue;
     }
 
+    // DEPRECATED - for API compatibility only - DO NOT USE
+
     /**
      * Send an FTP command. A successful CCC (Clear Command Channel) command causes the underlying {@link SSLSocket} instance to be assigned to a plain
      * {@link Socket}
@@ -973,8 +1044,6 @@ public class FTPSClient extends FTPClient {
         this.keyManager = keyManager;
     }
 
-    // DEPRECATED - for API compatibility only - DO NOT USE
-
     /**
      * Configures the socket to require client authentication.
      *
@@ -1051,74 +1120,5 @@ public class FTPSClient extends FTPClient {
             throw new SSLHandshakeException("Hostname doesn't match certificate");
         }
     }
-
-    /**
-     * Gets the security mode. (True - Implicit Mode / False - Explicit Mode)
-     * @since 3.11.0
-     */
-    protected boolean isImplicit() {
-        return isImplicit;
-    }
-
-    /**
-     * Gets the secure socket protocol to be used, e.g. SSL/TLS.
-     * @since 3.11.0
-     */
-    protected String getProtocol() {
-        return protocol;
-    }
-
-    /**
-     * Gets whether a new SSL session may be established by this socket. Default true
-     * @since 3.11.0
-     */
-    protected boolean isCreation() {
-        return isCreation;
-    }
-
-    /**
-     * Gets the use client mode flag. The {@link #getUseClientMode()} method gets the value from the socket while
-     * this method gets its value from this instance's config.
-     * @since 3.11.0
-     */
-    protected boolean isClientMode() {
-        return isClientMode;
-    }
-
-    /**
-     * Gets the need client auth flag. The {@link #getNeedClientAuth()} method gets the value from the socket while
-     * this method gets its value from this instance's config.
-     * @since 3.11.0
-     */
-    protected boolean isNeedClientAuth() {
-        return isNeedClientAuth;
-    }
-
-    /**
-     * Gets the want client auth flag. The {@link #getWantClientAuth()} method gets the value from the socket while
-     * this method gets its value from this instance's config.
-     * @since 3.11.0
-     */
-    protected boolean isWantClientAuth() {
-        return isWantClientAuth;
-    }
-
-    /**
-     * Gets the cipher suites. The {@link #getEnabledCipherSuites()} method gets the value from the socket while
-     * this method gets its value from this instance's config.
-     * @since 3.11.0
-     */
-    protected String[] getSuites() {
-        return suites == null ? null : suites.clone();
-    }
-
-    /**
-     * Gets the protocol versions. The {@link #getEnabledProtocols()} method gets the value from the socket while
-     * this method gets its value from this instance's config.
-     * @since 3.11.0
-     */
-    protected String[] getProtocols() {
-        return protocols == null ? null : protocols.clone();
-    }
 }