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 2021/03/25 19:47:37 UTC

[mina-sshd] 01/05: [SSHD-1141] Fix some formatting issues

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 72ce4b8a0b8d19f5984e1f965a4052a2311b9e42
Author: Lyor Goldstein <lg...@apache.org>
AuthorDate: Thu Mar 25 21:07:18 2021 +0200

    [SSHD-1141] Fix some formatting issues
---
 .../org/apache/sshd/client/auth/pubkey/UserAuthPublicKey.java |  9 ++++++---
 .../kex/extension/DefaultClientKexExtensionHandler.java       |  8 +++-----
 .../apache/sshd/common/auth/PublicKeyAuthenticationTest.java  | 11 ++++++-----
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/UserAuthPublicKey.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/UserAuthPublicKey.java
index eec73ec..743ca13 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/UserAuthPublicKey.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/UserAuthPublicKey.java
@@ -162,7 +162,8 @@ public class UserAuthPublicKey extends AbstractUserAuth implements SignatureFact
                     }
                 });
             }
-            currentAlgorithm = currentAlgorithms.isEmpty() ? keyType
+            currentAlgorithm = currentAlgorithms.isEmpty()
+                    ? keyType
                     : currentAlgorithms.poll();
         }
 
@@ -241,7 +242,8 @@ public class UserAuthPublicKey extends AbstractUserAuth implements SignatureFact
         if (!KeyUtils.compareKeys(rspKey, pubKey)) {
             throw new InvalidKeySpecException(
                     "processAuthDataRequest(" + session + ")[" + service + "][" + name + "]"
-                                              + " mismatched " + rspKeyType + " keys: expected=" + KeyUtils.getFingerPrint(pubKey)
+                                              + " mismatched " + rspKeyType + " keys: expected="
+                                              + KeyUtils.getFingerPrint(pubKey)
                                               + ", actual=" + KeyUtils.getFingerPrint(rspKey));
         }
 
@@ -254,7 +256,8 @@ public class UserAuthPublicKey extends AbstractUserAuth implements SignatureFact
         String algo = chosenAlgorithm;
         buffer = session.createBuffer(SshConstants.SSH_MSG_USERAUTH_REQUEST,
                 GenericUtils.length(username) + GenericUtils.length(service) + GenericUtils.length(name)
-                + GenericUtils.length(algo) + ByteArrayBuffer.DEFAULT_SIZE + Long.SIZE);
+                                                                             + GenericUtils.length(algo)
+                                                                             + ByteArrayBuffer.DEFAULT_SIZE + Long.SIZE);
         buffer.putString(username);
         buffer.putString(service);
         buffer.putString(name);
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/kex/extension/DefaultClientKexExtensionHandler.java b/sshd-core/src/main/java/org/apache/sshd/common/kex/extension/DefaultClientKexExtensionHandler.java
index 9085def..27733f8 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/kex/extension/DefaultClientKexExtensionHandler.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/kex/extension/DefaultClientKexExtensionHandler.java
@@ -112,10 +112,8 @@ public class DefaultClientKexExtensionHandler extends AbstractLoggingBean implem
     /**
      * Perform updates after a server-sig-algs extension has been received.
      *
-     * @param session
-     *            the message was received for
-     * @param serverAlgorithms
-     *            signature algorithm names announced by the server
+     * @param session          the message was received for
+     * @param serverAlgorithms signature algorithm names announced by the server
      */
     protected void handleServerSignatureAlgorithms(Session session, Collection<String> serverAlgorithms) {
         if (log.isDebugEnabled()) {
@@ -133,7 +131,7 @@ public class DefaultClientKexExtensionHandler extends AbstractLoggingBean implem
             List<NamedFactory<Signature>> unknown = new ArrayList<>();
             Set<String> known = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
             known.addAll(serverAlgorithms);
-            for (Iterator<NamedFactory<Signature>> i = clientAlgorithms.iterator(); i.hasNext(); ) {
+            for (Iterator<NamedFactory<Signature>> i = clientAlgorithms.iterator(); i.hasNext();) {
                 NamedFactory<Signature> algo = i.next();
                 if (!known.contains(algo.getName())) {
                     unknown.add(algo);
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/auth/PublicKeyAuthenticationTest.java b/sshd-core/src/test/java/org/apache/sshd/common/auth/PublicKeyAuthenticationTest.java
index aa0c2cf..8a185ce 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/auth/PublicKeyAuthenticationTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/auth/PublicKeyAuthenticationTest.java
@@ -147,9 +147,9 @@ public class PublicKeyAuthenticationTest extends AuthenticationTestSupport {
                         return new org.apache.sshd.server.auth.pubkey.UserAuthPublicKey() {
                             @Override
                             protected void sendPublicKeyResponse(
-                                ServerSession session, String username, String alg, PublicKey key,
-                                byte[] keyBlob, int offset, int blobLen, Buffer buffer)
-                                throws Exception {
+                                    ServerSession session, String username, String alg, PublicKey key,
+                                    byte[] keyBlob, int offset, int blobLen, Buffer buffer)
+                                    throws Exception {
                                 // send another key
                                 KeyPair otherPair = org.apache.sshd.util.test.CommonTestSupportUtils
                                         .generateKeyPair(KeyUtils.RSA_ALGORITHM, 1024);
@@ -197,7 +197,8 @@ public class PublicKeyAuthenticationTest extends AuthenticationTestSupport {
                                     ServerSession session, String username, String alg, PublicKey key,
                                     byte[] keyBlob, int offset, int blobLen, Buffer buffer)
                                     throws Exception {
-                                super.sendPublicKeyResponse(session, username, KeyPairProvider.SSH_DSS, key, keyBlob, offset, blobLen, buffer);
+                                super.sendPublicKeyResponse(session, username, KeyPairProvider.SSH_DSS, key, keyBlob, offset,
+                                        blobLen, buffer);
                             }
                         };
                     }
@@ -417,7 +418,7 @@ public class PublicKeyAuthenticationTest extends AuthenticationTestSupport {
         // factory list for host key algorithms and public key signature algorithms. So we can't just
         // set the list to only "ssh-rsa".
         boolean sshRsaFound = false;
-        for (Iterator<String> i = factoryNames.iterator(); i.hasNext(); ) {
+        for (Iterator<String> i = factoryNames.iterator(); i.hasNext();) {
             String name = i.next();
             if (name.equalsIgnoreCase("ssh-rsa")) {
                 sshRsaFound = true;