ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r667587 - in /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh: ScpFromMessageBySftp.java ScpToMessageBySftp.java
Date Fri, 13 Jun 2008 16:37:25 GMT
Author: stevel
Date: Fri Jun 13 09:37:25 2008
New Revision: 667587

URL: http://svn.apache.org/viewvc?rev=667587&view=rev
Log:
add some useful diagnostics messages when sftp fails.

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessageBySftp.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java?rev=667587&r1=667586&r2=667587&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java
Fri Jun 13 09:37:25 2008
@@ -94,7 +94,11 @@
             }
             getDir(channel, remoteFile, localFile);
         } catch (SftpException e) {
-            throw new JSchException(e.toString());
+            JSchException schException = new JSchException("Could not get '"+ remoteFile
+                    +"' to '"+localFile+"' - "
+                    +e.toString());
+            schException.initCause(e);
+            throw schException;
         } finally {
             if (channel != null) {
                 channel.disconnect();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessageBySftp.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessageBySftp.java?rev=667587&r1=667586&r2=667587&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessageBySftp.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessageBySftp.java
Fri Jun 13 09:37:25 2008
@@ -134,7 +134,11 @@
             try {
                 sendFileToRemote(channel, localFile, remotePath);
             } catch (SftpException e) {
-                throw new JSchException(e.toString());
+                JSchException schException = new JSchException("Could not send '" + localFile
+                        + "' to '" + remotePath + "' - "
+                        + e.toString());
+                schException.initCause(e);
+                throw schException;
             }
         } finally {
             if (channel != null) {
@@ -150,12 +154,23 @@
 
             try {
                 channel.cd(remotePath);
+            } catch (SftpException e) {
+                JSchException schException = new JSchException("Could not CD to '" + remotePath
+ "' - " + e.toString());
+                schException.initCause(e);
+                throw schException;
+            }
+            try {
                 for (Iterator i = directoryList.iterator(); i.hasNext();) {
                     Directory current = (Directory) i.next();
+                    if(getVerbose()) {
+                        log("Sending directory " + current);
+                    }
                     sendDirectory(channel, current);
                 }
             } catch (SftpException e) {
-                throw new JSchException(e.toString());
+                JSchException schException = new JSchException(e.toString());
+                schException.initCause(e);
+                throw schException;
             }
         } finally {
             if (channel != null) {



Mime
View raw message