You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2019/02/08 22:26:44 UTC

[GitHub] cquoss commented on a change in pull request #89: SCM-919 jgit codecheck cleanup

cquoss commented on a change in pull request #89: SCM-919 jgit codecheck cleanup
URL: https://github.com/apache/maven-scm/pull/89#discussion_r255255441
 
 

 ##########
 File path: maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/JGitTransportConfigCallback.java
 ##########
 @@ -25,81 +25,106 @@
 import org.apache.maven.scm.log.ScmLogger;
 import org.apache.maven.scm.provider.git.repository.GitScmProviderRepository;
 import org.eclipse.jgit.api.TransportConfigCallback;
-import org.eclipse.jgit.transport.*;
+import org.eclipse.jgit.transport.JschConfigSessionFactory;
+import org.eclipse.jgit.transport.OpenSshConfig;
+import org.eclipse.jgit.transport.SshSessionFactory;
+import org.eclipse.jgit.transport.SshTransport;
+import org.eclipse.jgit.transport.Transport;
 import org.eclipse.jgit.util.FS;
 import org.eclipse.jgit.util.StringUtils;
 
 /**
  * Implementation of {@link TransportConfigCallback} which adds
  * a public/private key identity to ssh URLs if configured.
  */
-public class JGitTransportConfigCallback implements TransportConfigCallback {
+public class JGitTransportConfigCallback implements TransportConfigCallback
+{
     private SshSessionFactory sshSessionFactory = null;
 
-    public JGitTransportConfigCallback(GitScmProviderRepository repo, ScmLogger logger) {
-        if (repo.getFetchInfo().getProtocol().equals("ssh")) {
-            if (!StringUtils.isEmptyOrNull(repo.getPrivateKey()) && repo.getPassphrase() == null) {
-                logger.debug("using private key with passphrase: " + repo.getPrivateKey());
-                sshSessionFactory = new UnprotectedPrivateKeySessionFactory(repo);
-            } else if (!StringUtils.isEmptyOrNull(repo.getPrivateKey()) && repo.getPassphrase() != null) {
-                logger.debug("using private key: " + repo.getPrivateKey());
-                sshSessionFactory = new ProtectedPrivateKeyFileSessionFactory(repo);
-            } else {
+    public JGitTransportConfigCallback( GitScmProviderRepository repo, ScmLogger logger )
+    {
+        if ( repo.getFetchInfo().getProtocol().equals( "ssh" ) )
+        {
+            if ( !StringUtils.isEmptyOrNull( repo.getPrivateKey() ) && repo.getPassphrase() == null )
+            {
+                logger.debug( "using private key with passphrase: " + repo.getPrivateKey() );
 
 Review comment:
   You're right.  Will switch the messages.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services