ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r677211 - in /ant/core/trunk: CONTRIBUTORS WHATSNEW contributors.xml src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessageBySftp.java
Date Wed, 16 Jul 2008 09:32:52 GMT
Author: bodewig
Date: Wed Jul 16 02:32:52 2008
New Revision: 677211

URL: http://svn.apache.org/viewvc?rev=677211&view=rev
Log:
Create remoteDir if needed, More meaningful error when exception occurs.  PR 42781.  Submitted
by Eduard Wirch.

Modified:
    ant/core/trunk/CONTRIBUTORS
    ant/core/trunk/WHATSNEW
    ant/core/trunk/contributors.xml
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessageBySftp.java

Modified: ant/core/trunk/CONTRIBUTORS
URL: http://svn.apache.org/viewvc/ant/core/trunk/CONTRIBUTORS?rev=677211&r1=677210&r2=677211&view=diff
==============================================================================
Binary files - no diff available.

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=677211&r1=677210&r2=677211&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Wed Jul 16 02:32:52 2008
@@ -104,6 +104,9 @@
  * XmlLogger could lose messages if <parallel> is used.
    Bugzilla Report 25734.
 
+ * <scp> creates remoteToDir if it doesn't exist.
+   Bugzilla Report 42781
+
 Other changes:
 --------------
 

Modified: ant/core/trunk/contributors.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/contributors.xml?rev=677211&r1=677210&r2=677211&view=diff
==============================================================================
--- ant/core/trunk/contributors.xml (original)
+++ ant/core/trunk/contributors.xml Wed Jul 16 02:32:52 2008
@@ -320,6 +320,10 @@
     <last>Sudell</last>
   </name>
   <name>
+    <first>Eduard</first>
+    <last>Wirch</last>
+  </name>
+  <name>
     <first>Edwin</first>
     <last>Woudt</last>
   </name>

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=677211&r1=677210&r2=677211&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
Wed Jul 16 02:32:52 2008
@@ -153,24 +153,37 @@
             channel.connect();
 
             try {
+                try {
+                    channel.stat(remotePath);
+                } catch (SftpException e) {
+                    if (e.id == ChannelSftp.SSH_FX_NO_SUCH_FILE) {
+                        // dir does not exist.
+                        channel.mkdir(remotePath);
+                    } else {
+                        throw new JSchException("failed to access remote dir '"
+                                                + remotePath + "'", e);
+                    }
+                }
                 channel.cd(remotePath);
             } catch (SftpException e) {
-                JSchException schException = new JSchException("Could not CD to '" + remotePath
+ "' - " + e.toString());
-                schException.initCause(e);
-                throw schException;
+                throw new JSchException("Could not CD to '" + remotePath
+                                        + "' - " + e.toString(), e);
             }
+            Directory current = null;
             try {
                 for (Iterator i = directoryList.iterator(); i.hasNext();) {
-                    Directory current = (Directory) i.next();
-                    if(getVerbose()) {
+                    current = (Directory) i.next();
+                    if (getVerbose()) {
                         log("Sending directory " + current);
                     }
                     sendDirectory(channel, current);
                 }
             } catch (SftpException e) {
-                JSchException schException = new JSchException(e.toString());
-                schException.initCause(e);
-                throw schException;
+                String msg = "Error sending directory";
+                if (current != null && current.getDirectory() != null) {
+                    msg += " '" + current.getDirectory().getName() + "'";
+                }
+                throw new JSchException(msg, e);
             }
         } finally {
             if (channel != null) {



Mime
View raw message