Browse Source

add some useful diagnostics messages when sftp fails.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@667587 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 17 years ago
parent
commit
7d77f6e9fb
2 changed files with 22 additions and 3 deletions
  1. +5
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java
  2. +17
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessageBySftp.java

+ 5
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java View File

@@ -94,7 +94,11 @@ public class ScpFromMessageBySftp extends ScpFromMessage {
}
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();


+ 17
- 2
src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessageBySftp.java View File

@@ -134,7 +134,11 @@ public class ScpToMessageBySftp extends ScpToMessage/*AbstractSshMessage*/ {
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 @@ public class ScpToMessageBySftp extends ScpToMessage/*AbstractSshMessage*/ {

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


Loading…
Cancel
Save