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 2020/09/20 16:28:20 UTC

[commons-net] branch master updated (e663194 -> 8544697)

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 e663194  Fix Javadoc warning.
     new 2e2897d  [NET-687][FTPS] javax.net.ssl.SSLException: Unsupported or unrecognized SSL message, #59.
     new 8544697  Fix Checkstyle. Don't allow junk Javadocs. Use the POM default goal from CIs.

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:
 .github/workflows/maven.yml                        |  3 +-
 .travis.yml                                        |  1 -
 checkstyle.xml                                     | 10 ++---
 pom.xml                                            |  1 +
 src/changes/changes.xml                            |  4 ++
 .../org/apache/commons/net/ftp/FTPSClient.java     |  1 -
 .../commons/net/ftp/parser/MVSFTPEntryParser.java  |  2 +-
 .../org/apache/commons/net/ftp/FTPSClientTest.java | 48 ++++++++++++++++++----
 .../apache/commons/net/ftpsserver/users.properties |  6 +--
 .../org/apache/commons/net/test-data/file.txt      | 20 +++++++++
 10 files changed, 74 insertions(+), 22 deletions(-)
 create mode 100644 src/test/resources/org/apache/commons/net/test-data/file.txt


[commons-net] 02/02: Fix Checkstyle. Don't allow junk Javadocs. Use the POM default goal from CIs.

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 8544697a7169b82456c27b6dd60379f8f7704bcf
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Sep 20 12:28:16 2020 -0400

    Fix Checkstyle. Don't allow junk Javadocs. Use the POM default goal from
    CIs.
---
 .github/workflows/maven.yml                                    |  3 +--
 .travis.yml                                                    |  1 -
 checkstyle.xml                                                 | 10 ++++------
 pom.xml                                                        |  1 +
 src/changes/changes.xml                                        |  2 +-
 .../org/apache/commons/net/ftp/parser/MVSFTPEntryParser.java   |  2 +-
 6 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index ebe35a7..26e7b03 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -43,5 +43,4 @@ jobs:
       with:
         java-version: ${{ matrix.java }}
     - name: Build with Maven
-      run: mvn --batch-mode apache-rat:check javadoc:javadoc -Ddoclint=all package --file pom.xml --no-transfer-progress
-#      run: mvn --batch-mode apache-rat:check package --file pom.xml
+      run: mvn --batch-mode -Ddoclint=all --file pom.xml --no-transfer-progress
diff --git a/.travis.yml b/.travis.yml
index 834887a..da0a1b6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,7 +15,6 @@
 
 language: java
 sudo: false
-dist: trusty
 cache:
   directories:
     - $HOME/.m2
diff --git a/checkstyle.xml b/checkstyle.xml
index ac652d4..bdc6f1e 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -48,6 +48,10 @@ limitations under the License.
     <property name="fileExtensions" value="java" />
   </module>
 
+  <module name="LineLength">
+    <property name="max" value="132"/>
+  </module>
+
   <module name="TreeWalker">
     <module name="AvoidStarImport">
       <property name="excludes" value="org.junit.Assert"/>
@@ -55,9 +59,6 @@ limitations under the License.
     <module name="RedundantImport"/>
     <module name="UnusedImports"/>
     <module name="NeedBraces"/>
-    <module name="LineLength">
-      <property name="max" value="132"/>
-    </module>
 
     <!-- Modifier Checks                                    -->
     <!-- See http://checkstyle.sf.net/config_modifiers.html -->
@@ -75,10 +76,7 @@ limitations under the License.
 
     <module name="JavadocMethod">
       <property name="scope" value="public"/>
-      <property name="allowUndeclaredRTE" value="true"/>
-      <property name="allowMissingJavadoc" value="true"/>
       <property name="allowMissingParamTags" value="true"/>
-      <property name="allowMissingThrowsTags" value="true"/>
     </module>
 
     <module name="SuppressionCommentFilter"/>
diff --git a/pom.xml b/pom.xml
index 6546d8b..1ac0f0d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -107,6 +107,7 @@ Supported protocols include: Echo, Finger, FTP, NNTP, NTP, POP3(S), SMTP(S), Tel
     </dependencies>
 
     <build>
+        <defaultGoal>clean apache-rat:check javadoc:javadoc checkstyle:check clirr:check package</defaultGoal>
         <pluginManagement>
           <plugins>
             <!-- Allow CLI usage -->
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 7b8a13b..d85b29c 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -65,7 +65,7 @@ The <action> type attribute can be add,update,fix,remove.
     <body>
         <release version="3.8" date="20YY-MM-DD" description="TBD">
             <action issue="NET-687" type="fix" dev="ggregory" due-to="Gary Gregory, Mikael, j-verse">
-            Update actions/checkout from v2.3.1 to v2.3.2 #56.
+            [FTPS] javax.net.ssl.SSLException: Unsupported or unrecognized SSL message, #59.
             </action>
         	<!--  UPDATES -->
             <action issue="NET-673" type="fix" dev="ggregory" due-to="Dependabot">
diff --git a/src/main/java/org/apache/commons/net/ftp/parser/MVSFTPEntryParser.java b/src/main/java/org/apache/commons/net/ftp/parser/MVSFTPEntryParser.java
index 60946b5..c24ca2c 100644
--- a/src/main/java/org/apache/commons/net/ftp/parser/MVSFTPEntryParser.java
+++ b/src/main/java/org/apache/commons/net/ftp/parser/MVSFTPEntryParser.java
@@ -60,7 +60,7 @@ public class MVSFTPEntryParser extends ConfigurableFTPFileEntryParserImpl {
      *  Volume Unit    Referred Ext Used Recfm Lrecl BlkSz Dsorg Dsname
      *  B10142 3390   2006/03/20  2   31  F       80    80  PS   MDI.OKL.WORK
      * </pre>
-     * 
+     *
      * @see <a href=
      *      "https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zconcepts/zconcepts_159.htm">Data
      *      set record formats</a>


[commons-net] 01/02: [NET-687][FTPS] javax.net.ssl.SSLException: Unsupported or unrecognized SSL message, #59.

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 2e2897dcb82308019bdd40be3b5eede7918a572d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Sep 20 12:22:10 2020 -0400

    [NET-687][FTPS] javax.net.ssl.SSLException: Unsupported or unrecognized
    SSL message, #59.
---
 src/changes/changes.xml                            |  4 ++
 .../org/apache/commons/net/ftp/FTPSClient.java     |  1 -
 .../org/apache/commons/net/ftp/FTPSClientTest.java | 48 ++++++++++++++++++----
 .../apache/commons/net/ftpsserver/users.properties |  6 +--
 .../org/apache/commons/net/test-data/file.txt      | 20 +++++++++
 5 files changed, 67 insertions(+), 12 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index c5a826d..7b8a13b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -64,6 +64,10 @@ The <action> type attribute can be add,update,fix,remove.
 
     <body>
         <release version="3.8" date="20YY-MM-DD" description="TBD">
+            <action issue="NET-687" type="fix" dev="ggregory" due-to="Gary Gregory, Mikael, j-verse">
+            Update actions/checkout from v2.3.1 to v2.3.2 #56.
+            </action>
+        	<!--  UPDATES -->
             <action issue="NET-673" type="fix" dev="ggregory" due-to="Dependabot">
             Update actions/checkout from v2.3.1 to v2.3.2 #56.
             </action>
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 02cf59a..504915e 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
@@ -620,7 +620,6 @@ public class FTPSClient extends FTPClient {
     protected Socket _openDataConnection_(String command, String arg)
             throws IOException {
         Socket socket = super._openDataConnection_(command, arg);
-        socket = createSSLSocket(socket);
         _prepareDataSocket_(socket);
         if (socket instanceof SSLSocket) {
             SSLSocket sslSocket = (SSLSocket)socket;
diff --git a/src/test/java/org/apache/commons/net/ftp/FTPSClientTest.java b/src/test/java/org/apache/commons/net/ftp/FTPSClientTest.java
index 004c968..e781541 100644
--- a/src/test/java/org/apache/commons/net/ftp/FTPSClientTest.java
+++ b/src/test/java/org/apache/commons/net/ftp/FTPSClientTest.java
@@ -27,6 +27,7 @@ import java.net.SocketException;
 import java.net.URL;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.output.NullOutputStream;
 import org.apache.ftpserver.FtpServer;
 import org.apache.ftpserver.FtpServerFactory;
 import org.apache.ftpserver.ftplet.FtpException;
@@ -56,13 +57,10 @@ public class FTPSClientTest {
 
     /**
      * Returns the test directory as a String.
-     * <p>
-     * {@link #getTestDirectoryFile()} should be preferred.
-     *
      * @return the test directory as a String
      */
-    private static String getTestDirectory() {
-        return System.getProperty("test.basedir", "target/test-classes/test-data");
+    private static String getTestHomeDirectory() {
+        return System.getProperty("test.basedir", "target/test-classes/org/apache/commons/net/test-data");
     }
 
     private static final boolean implicit = false;
@@ -83,6 +81,7 @@ public class FTPSClientTest {
         if (Server != null) {
             return;
         }
+        // Use an ephemeral port.
         SocketPort = 0;
         final FtpServerFactory serverFactory = new FtpServerFactory();
         final PropertiesUserManagerFactory propertiesUserManagerFactory = new PropertiesUserManagerFactory();
@@ -93,7 +92,7 @@ public class FTPSClientTest {
         final BaseUser user = (BaseUser) userManager.getUserByName("test");
         // Pickup the home dir value at runtime even though we have it set in the user prop file
         // The user prop file requires the "homedirectory" to be set
-        user.setHomeDirectory(getTestDirectory());
+        user.setHomeDirectory(getTestHomeDirectory());
         serverFactory.setUserManager(userManager);
         final ListenerFactory factory = new ListenerFactory();
         // set the port of the listener
@@ -125,13 +124,28 @@ public class FTPSClientTest {
     private FTPSClient loginClient() throws SocketException, IOException {
         FTPSClient client = new FTPSClient(implicit);
         client.connect("localhost", SocketPort);
+        assertClientCode(client);
         assertEquals(SocketPort, client.getRemotePort());
-        final int replyCode = client.getReplyCode();
-        assertTrue(FTPReply.isPositiveCompletion(replyCode));
+        //
         assertTrue(client.login("test", "test"));
+        assertClientCode(client);
+        //
+        client.setFileType(FTP.BINARY_FILE_TYPE);
+        assertClientCode(client);
+        //
+        client.execPBSZ(0);
+        assertClientCode(client);
+        //
+        client.execPROT("P");
+        assertClientCode(client);
         return client;
     }
 
+    private void assertClientCode(FTPSClient client) {
+        final int replyCode = client.getReplyCode();
+        assertTrue(FTPReply.isPositiveCompletion(replyCode));
+    }
+
     @Test
     public void testOpenClose() throws SocketException, IOException {
         loginClient().disconnect();
@@ -148,12 +162,29 @@ public class FTPSClientTest {
         }
     }
 
+    private void retrieveFile(String pathname) throws SocketException, IOException {
+        FTPSClient client = loginClient();
+        try {
+            // Do it twice.
+            // Just testing that we are not getting an SSL error (the file MUST be present).
+            assertTrue(pathname, client.retrieveFile(pathname, NullOutputStream.NULL_OUTPUT_STREAM));
+            assertTrue(pathname, client.retrieveFile(pathname, NullOutputStream.NULL_OUTPUT_STREAM));
+        } finally {
+            client.disconnect();
+        }
+    }
+
     @Test
     public void testListFilesPathNameRoot() throws SocketException, IOException {
         testListFiles("/");
     }
 
     @Test
+    public void testRetrieveFilePathNameRoot() throws SocketException, IOException {
+        retrieveFile("/file.txt");
+    }
+
+    @Test
     public void testListFilesPathNameEmpty() throws SocketException, IOException {
         testListFiles("");
     }
@@ -168,3 +199,4 @@ public class FTPSClientTest {
         testListFiles("   Junk   ");
     }
 }
+
diff --git a/src/test/resources/org/apache/commons/net/ftpsserver/users.properties b/src/test/resources/org/apache/commons/net/ftpsserver/users.properties
index 59fe696..521c443 100644
--- a/src/test/resources/org/apache/commons/net/ftpsserver/users.properties
+++ b/src/test/resources/org/apache/commons/net/ftpsserver/users.properties
@@ -17,7 +17,7 @@
 
 # Password is "admin"
 ftpserver.user.admin.userpassword=21232F297A57A5A743894A0E4A801FC3
-ftpserver.user.admin.homedirectory=target/test-classes/test-data
+ftpserver.user.admin.homedirectory=target/test-classes/org/apache/commons/net/test-data
 ftpserver.user.admin.enableflag=true
 ftpserver.user.admin.writepermission=true
 ftpserver.user.admin.maxloginnumber=0
@@ -27,7 +27,7 @@ ftpserver.user.admin.uploadrate=0
 ftpserver.user.admin.downloadrate=0
 
 ftpserver.user.anonymous.userpassword=
-ftpserver.user.anonymous.homedirectory=target/test-classes/test-data
+ftpserver.user.anonymous.homedirectory=target/test-classes/org/apache/commons/net/test-data
 ftpserver.user.anonymous.enableflag=true
 ftpserver.user.anonymous.writepermission=false
 ftpserver.user.anonymous.maxloginnumber=20
@@ -38,6 +38,6 @@ ftpserver.user.anonymous.downloadrate=4800
 
 # password is "test"
 ftpserver.user.test.userpassword=098f6bcd4621d373cade4e832627b4f6
-ftpserver.user.test.homedirectory=target/test-classes/test-data
+ftpserver.user.test.homedirectory=target/test-classes/org/apache/commons/net/test-data
 ftpserver.user.test.enableflag=true
 ftpserver.user.test.writepermission=true
diff --git a/src/test/resources/org/apache/commons/net/test-data/file.txt b/src/test/resources/org/apache/commons/net/test-data/file.txt
new file mode 100644
index 0000000..eba8c13
--- /dev/null
+++ b/src/test/resources/org/apache/commons/net/test-data/file.txt
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+“We are all in the gutter, but some of us are looking at the stars.”
+
+― Oscar Wilde, Lady Windermere's Fan