maven-wagon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r312632 - /maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java
Date Mon, 10 Oct 2005 12:30:40 GMT
Author: brett
Date: Mon Oct 10 05:30:37 2005
New Revision: 312632

URL: http://svn.apache.org/viewcvs?rev=312632&view=rev
Log:
handle missing files in scpexe

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

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java?rev=312632&r1=312631&r2=312632&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/sshext/ScpExternalWagon.java
Mon Oct 10 05:30:37 2005
@@ -200,7 +200,7 @@
 
 
     private void executeScpCommand( File localFile, String remoteFile, boolean put )
-        throws TransferFailedException
+        throws TransferFailedException, ResourceDoesNotExistException
     {
         Commandline cl = new Commandline();
 
@@ -215,7 +215,7 @@
         }
 
         if ( port != WagonConstants.UNKNOWN_PORT )
-        {            
+        {
             cl.createArgument().setLine( "-P " + port );
         }
 
@@ -237,7 +237,19 @@
         }
         try
         {
-            CommandLineUtils.executeCommandLine( cl, null, null );
+            CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
+            int exitCode = CommandLineUtils.executeCommandLine( cl, null, err );
+            if ( exitCode != 0 )
+            {
+                if ( !put && err.getOutput().trim().endsWith( "No such file or directory"
) )
+                {
+                    throw new ResourceDoesNotExistException( err.getOutput() );
+                }
+                else
+                {
+                    throw new TransferFailedException( "Exit code: " + exitCode + " - " +
err.getOutput() );
+                }
+            }
         }
         catch ( CommandLineException e )
         {



---------------------------------------------------------------------
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