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 2020/05/22 13:25:47 UTC

[mina-sshd] branch master updated: Do not re-format code comments - only Javadoc ones

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 34d20f8  Do not re-format code comments - only Javadoc ones
34d20f8 is described below

commit 34d20f8886f4d65c61cb6ca3a3486ad099437f4f
Author: Lyor Goldstein <lg...@apache.org>
AuthorDate: Fri May 22 16:20:04 2020 +0300

    Do not re-format code comments - only Javadoc ones
---
 .../loader/pem/ECDSAPEMResourceKeyPairParser.java  | 23 ++++++-------
 .../pem/PKCS8PEMResourceKeyPairParserTest.java     |  5 +--
 .../keyverifier/KnownHostsServerKeyVerifier.java   |  2 +-
 .../apache/sshd/common/kex/BuiltinDHFactories.java |  4 +--
 .../common/session/helpers/AbstractSession.java    |  4 +--
 .../sshd/server/channel/PipeDataReceiver.java      |  2 +-
 .../java/org/apache/sshd/client/ClientTest.java    |  8 ++---
 .../common/forward/PortForwardingLoadTest.java     | 40 +++++++++++-----------
 sshd-eclipse-formatter-config.xml                  |  6 ++--
 .../subsystem/sftp/impl/AbstractSftpClient.java    |  4 +--
 10 files changed, 47 insertions(+), 51 deletions(-)

diff --git a/sshd-common/src/main/java/org/apache/sshd/common/config/keys/loader/pem/ECDSAPEMResourceKeyPairParser.java b/sshd-common/src/main/java/org/apache/sshd/common/config/keys/loader/pem/ECDSAPEMResourceKeyPairParser.java
index 13b3f91..0fe9b15 100644
--- a/sshd-common/src/main/java/org/apache/sshd/common/config/keys/loader/pem/ECDSAPEMResourceKeyPairParser.java
+++ b/sshd-common/src/main/java/org/apache/sshd/common/config/keys/loader/pem/ECDSAPEMResourceKeyPairParser.java
@@ -155,12 +155,6 @@ public class ECDSAPEMResourceKeyPairParser extends AbstractPEMResourceKeyPairPar
                 throw new StreamCorruptedException("Unknown curve");
             }
 
-            /*
-             * According to https://tools.ietf.org/html/rfc5915 - section 3
-             *
-             * ECPrivateKey ::= SEQUENCE { version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1), privateKey OCTET
-             * STRING, parameters [0] ECParameters {{ NamedCurve }} OPTIONAL, publicKey [1] BIT STRING OPTIONAL }
-             */
             ECPoint w = decodeECPublicKeyValue(curve, parser);
             ECPublicKeySpec pubSpec = new ECPublicKeySpec(w, prvSpec.getParams());
             return new SimpleImmutableEntry<>(pubSpec, prvSpec);
@@ -170,8 +164,12 @@ public class ECDSAPEMResourceKeyPairParser extends AbstractPEMResourceKeyPairPar
     /*
      * According to https://tools.ietf.org/html/rfc5915 - section 3
      *
-     * ECPrivateKey ::= SEQUENCE { version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1), privateKey OCTET STRING,
-     * parameters [0] ECParameters {{ NamedCurve }} OPTIONAL, publicKey [1] BIT STRING OPTIONAL }
+     * ECPrivateKey ::= SEQUENCE {
+     *      version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1),
+     *      privateKey OCTET STRING,
+     *      parameters [0] ECParameters {{ NamedCurve }} OPTIONAL,
+     *      publicKey [1] BIT STRING OPTIONAL
+     * }
      */
     public static final ECPrivateKeySpec decodeECPrivateKeySpec(DERParser parser) throws IOException {
         // see openssl asn1parse -inform PEM -in ...file... -dump
@@ -183,8 +181,8 @@ public class ECDSAPEMResourceKeyPairParser extends AbstractPEMResourceKeyPairPar
         /*
          * According to https://tools.ietf.org/html/rfc5915 - section 3
          *
-         * For this version of the document, it SHALL be set to ecPrivkeyVer1, which is of type INTEGER and whose value
-         * is one (1)
+         * For this version of the document, it SHALL be set to ecPrivkeyVer1,
+         * which is of type INTEGER and whose value is one (1)
          */
         BigInteger version = versionObject.asInteger();
         if (!BigInteger.ONE.equals(version)) {
@@ -225,8 +223,9 @@ public class ECDSAPEMResourceKeyPairParser extends AbstractPEMResourceKeyPairPar
             }
 
             /*
-             * SSHD-989 - if object type is BIT STRING then this is the public key - in which case we need to figure out
-             * some other way to recover the curve parameters
+             * SSHD-989 - if object type is BIT STRING then this is the public
+             * key - in which case we need to figure out some other way to recover
+             * the curve parameters
              */
 
             curveOID = namedCurve.asOID();
diff --git a/sshd-common/src/test/java/org/apache/sshd/common/config/keys/loader/pem/PKCS8PEMResourceKeyPairParserTest.java b/sshd-common/src/test/java/org/apache/sshd/common/config/keys/loader/pem/PKCS8PEMResourceKeyPairParserTest.java
index 4dbdcaf..6d62616 100644
--- a/sshd-common/src/test/java/org/apache/sshd/common/config/keys/loader/pem/PKCS8PEMResourceKeyPairParserTest.java
+++ b/sshd-common/src/test/java/org/apache/sshd/common/config/keys/loader/pem/PKCS8PEMResourceKeyPairParserTest.java
@@ -115,13 +115,10 @@ public class PKCS8PEMResourceKeyPairParserTest extends JUnitTestSupport {
     }
 
     // see https://gist.github.com/briansmith/2ee42439923d8e65a266994d0f70180b
-    // openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -pkeyopt ec_param_enc:named_curve -out
-    // pkcs8-ecdsa-256.pem
+    // openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -pkeyopt ec_param_enc:named_curve -out pkcs8-ecdsa-256.pem
     // openssl ecparam -genkey -name prime256v1 -noout -out pkcs8-ec-256.key
     // openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in pkcs8-ec-256.key -out pkcs8-ec-256.pem
-
     // openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:1024 -out pkcs8-rsa-1024.pem
-
     // openssl asn1parse -inform PEM -in ...file... -dump
     @Test // see SSHD-989
     @Ignore("WIP")
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java
index b0d1f35..f464d10 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/keyverifier/KnownHostsServerKeyVerifier.java
@@ -674,7 +674,7 @@ public class KnownHostsServerKeyVerifier
 
                 output.write(lineData);
                 output.write(eolBytes); // add another separator for trailing lines - in case regular SSH client appends
-                                        // to it
+                                       // to it
             }
         }
 
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java b/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java
index b0f7df3..9b6dc5d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/kex/BuiltinDHFactories.java
@@ -160,7 +160,7 @@ public enum BuiltinDHFactories implements DHFactory {
 
         @Override
         public boolean isSupported() { // avoid "Prime size must be multiple of 64, and can only range from 512 to 2048
-                                       // (inclusive)"
+                                      // (inclusive)"
             return SecurityUtils.isDHGroupExchangeSupported() && BuiltinDigests.sha1.isSupported();
         }
     },
@@ -177,7 +177,7 @@ public enum BuiltinDHFactories implements DHFactory {
 
         @Override
         public boolean isSupported() { // avoid "Prime size must be multiple of 64, and can only range from 512 to 2048
-                                       // (inclusive)"
+                                      // (inclusive)"
             return SecurityUtils.isDHGroupExchangeSupported() && BuiltinDigests.sha256.isSupported();
         }
 
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 47a56b9..1ccdf14 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
@@ -1675,8 +1675,8 @@ public abstract class AbstractSession extends SessionHelper {
         // select the lowest cipher size
         int avgCipherBlockSize = Math.min(inCipherSize, outCipherSize);
         long recommendedByteRekeyBlocks = 1L << Math.min((avgCipherBlockSize * Byte.SIZE) / 4, 63); // in case
-                                                                                                    // (block-size / 4)
-                                                                                                    // > 63
+                                                                                                   // (block-size / 4)
+                                                                                                   // > 63
         long effectiveRekyBlocksCount = getLongProperty(FactoryManager.REKEY_BLOCKS_LIMIT, recommendedByteRekeyBlocks);
         maxRekeyBlocks.set(effectiveRekyBlocksCount);
         if (debugEnabled) {
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/channel/PipeDataReceiver.java b/sshd-core/src/main/java/org/apache/sshd/server/channel/PipeDataReceiver.java
index 6890b9a..cc7118d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/channel/PipeDataReceiver.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/channel/PipeDataReceiver.java
@@ -61,6 +61,6 @@ public class PipeDataReceiver extends AbstractLoggingBean implements ChannelData
     public int data(ChannelSession channel, byte[] buf, int start, int len) throws IOException {
         out.write(buf, start, len);
         return 0; // ChannelPipedOutputStream calls consume method on its own, so here we return 0 to make the ends
-                  // meet.
+                 // meet.
     }
 }
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 eef6073..7812473 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
@@ -870,10 +870,10 @@ public class ClientTest extends BaseTestSupport {
     @Test
     public void testClientWithLengthyDialog() throws Exception {
         // Reduce window size and packet size
-//        FactoryManagerUtils.updateProperty(client, SshClient.WINDOW_SIZE, 0x20000);
-//        FactoryManagerUtils.updateProperty(client, SshClient.MAX_PACKET_SIZE, 0x1000);
-//        FactoryManagerUtils.updateProperty(sshd, SshServer.WINDOW_SIZE, 0x20000);
-//        FactoryManagerUtils.updateProperty(sshd, SshServer.MAX_PACKET_SIZE, 0x1000);
+        //        FactoryManagerUtils.updateProperty(client, SshClient.WINDOW_SIZE, 0x20000);
+        //        FactoryManagerUtils.updateProperty(client, SshClient.MAX_PACKET_SIZE, 0x1000);
+        //        FactoryManagerUtils.updateProperty(sshd, SshServer.WINDOW_SIZE, 0x20000);
+        //        FactoryManagerUtils.updateProperty(sshd, SshServer.MAX_PACKET_SIZE, 0x1000);
         client.start();
 
         try (ClientSession session = createTestClientSession();
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingLoadTest.java b/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingLoadTest.java
index 123bfc2..0ee499f 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingLoadTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/forward/PortForwardingLoadTest.java
@@ -464,10 +464,10 @@ public class PortForwardingLoadTest extends BaseTestSupport {
 
     @Test
     public void testForwardingOnLoad() throws Exception {
-//        final String path = "/history/recent/troubles/";
-//        final String host = "www.bbc.co.uk";
-//        final String path = "";
-//        final String host = "www.bahn.de";
+        //        final String path = "/history/recent/troubles/";
+        //        final String host = "www.bbc.co.uk";
+        //        final String path = "";
+        //        final String host = "www.bahn.de";
         final String path = "";
         final String host = TEST_LOCALHOST;
         final int nbThread = 2;
@@ -564,21 +564,21 @@ public class PortForwardingLoadTest extends BaseTestSupport {
         }
         assertTrue("Missing HTML close tag", str.indexOf("</html>") > 0);
         get.releaseConnection();
-//        url.openConnection().setDefaultUseCaches(false);
-//        Reader reader = new BufferedReader(new InputStreamReader(url.openStream()));
-//        try {
-//            StringWriter sw = new StringWriter();
-//            char[] buf = new char[8192];
-//            while (true) {
-//                int len = reader.read(buf);
-//                if (len < 0) {
-//                    break;
-//                }
-//                sw.write(buf, 0, len);
-//            }
-//            assertTrue(sw.toString().indexOf("</html>") > 0);
-//        } finally {
-//            reader.close();
-//        }
+        //        url.openConnection().setDefaultUseCaches(false);
+        //        Reader reader = new BufferedReader(new InputStreamReader(url.openStream()));
+        //        try {
+        //            StringWriter sw = new StringWriter();
+        //            char[] buf = new char[8192];
+        //            while (true) {
+        //                int len = reader.read(buf);
+        //                if (len < 0) {
+        //                    break;
+        //                }
+        //                sw.write(buf, 0, len);
+        //            }
+        //            assertTrue(sw.toString().indexOf("</html>") > 0);
+        //        } finally {
+        //            reader.close();
+        //        }
     }
 }
diff --git a/sshd-eclipse-formatter-config.xml b/sshd-eclipse-formatter-config.xml
index 1f72485..3f34f0d 100644
--- a/sshd-eclipse-formatter-config.xml
+++ b/sshd-eclipse-formatter-config.xml
@@ -92,11 +92,11 @@
         <setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
         <setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
         <setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="false"/>
-        <setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
+        <setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="false"/>
         <setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
         <setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
         <setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
-        <setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
+        <setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="false"/>
         <setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
         <setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
         <setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="false"/>
@@ -107,7 +107,7 @@
         <setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
         <setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
         <setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
-        <setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
+        <setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="true"/>
         <setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
         <setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
         <setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
diff --git a/sshd-sftp/src/main/java/org/apache/sshd/client/subsystem/sftp/impl/AbstractSftpClient.java b/sshd-sftp/src/main/java/org/apache/sshd/client/subsystem/sftp/impl/AbstractSftpClient.java
index 338f666..09ef081 100644
--- a/sshd-sftp/src/main/java/org/apache/sshd/client/subsystem/sftp/impl/AbstractSftpClient.java
+++ b/sshd-sftp/src/main/java/org/apache/sshd/client/subsystem/sftp/impl/AbstractSftpClient.java
@@ -458,7 +458,7 @@ public abstract class AbstractSftpClient extends AbstractSubsystemClient impleme
             if ((version >= SftpConstants.SFTP_V6) && (flags & SftpConstants.SSH_FILEXFER_ATTR_CTIME) != 0) {
                 @SuppressWarnings("unused")
                 FileTime attrsChangedTime = SftpHelper.readTime(buffer, version, flags); // TODO the last time the file
-                                                                                         // attributes were changed
+                                                                                        // attributes were changed
             }
 
             if ((flags & SftpConstants.SSH_FILEXFER_ATTR_ACL) != 0) {
@@ -492,7 +492,7 @@ public abstract class AbstractSftpClient extends AbstractSubsystemClient impleme
                 if ((flags & SftpConstants.SSH_FILEXFER_ATTR_UNTRANSLATED_NAME) != 0) {
                     @SuppressWarnings("unused")
                     String untranslated = getReferencedName(cmd, buffer, nameIndex.getAndIncrement()); // TODO: handle
-                                                                                                       // untranslated-name
+                                                                                                      // untranslated-name
                 }
             }
         } else {