maven-wagon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r660468 - /maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java
Date Tue, 27 May 2008 11:09:44 GMT
Author: brett
Date: Tue May 27 04:09:43 2008
New Revision: 660468

URL: http://svn.apache.org/viewvc?rev=660468&view=rev
Log:
[WAGON-153] wagon ignores username part of scpexe URLs
Submitted by: Wolfgang Glas

Modified:
    maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java?rev=660468&r1=660467&r2=660468&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java
Tue May 27 04:09:43 2008
@@ -89,6 +89,20 @@
     //
     // ----------------------------------------------------------------------
 
+    /**
+     * @return The hostname of the remote server prefixed with the username, which comes
either from the repository URL
+     *         or from the authenticationInfo.
+     */
+    private String buildRemoteHost()
+    {
+        String username = this.getRepository().getUsername();
+        if ( username == null )
+        {
+            username = authenticationInfo.getUserName();
+        }
+        return username + "@" + getRepository().getHost();
+    }
+    
     public Streams executeCommand( String command, boolean ignoreFailures )
         throws CommandExecutionException
     {
@@ -113,7 +127,8 @@
         {
             cl.createArgument().setLine( sshArgs );
         }
-        String remoteHost = authenticationInfo.getUserName() + "@" + getRepository().getHost();
+        
+        String remoteHost = this.buildRemoteHost();
 
         cl.createArgument().setValue( remoteHost );
 
@@ -199,8 +214,7 @@
         {
             cl.createArgument().setLine( scpArgs );
         }
-        String qualifiedRemoteFile =
-            authenticationInfo.getUserName() + "@" + getRepository().getHost() + ":" + remoteFile;
+        String qualifiedRemoteFile = this.buildRemoteHost() + ":" + remoteFile;
         if ( put )
         {
             cl.createArgument().setValue( localFile.getName() );



---------------------------------------------------------------------
To unsubscribe, e-mail: wagon-commits-unsubscribe@maven.apache.org
For additional commands, e-mail: wagon-commits-help@maven.apache.org


Mime
View raw message