bodewig 2003/03/10 02:05:43
Modified: src/main/org/apache/tools/ant/taskdefs/optional/ssh AbstractSshMessage.java Scp.java ScpFromMessage.java ScpToMessage.java Log: Upgrade to jsch-0.1.2 Revision Changes Path 1.2 +4 -3 ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java Index: AbstractSshMessage.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AbstractSshMessage.java 6 Mar 2003 12:42:44 -0000 1.1 +++ AbstractSshMessage.java 10 Mar 2003 10:05:43 -0000 1.2 @@ -54,9 +54,10 @@ package org.apache.tools.ant.taskdefs.optional.ssh; -import com.jcraft.jsch.Session; import com.jcraft.jsch.Channel; import com.jcraft.jsch.ChannelExec; +import com.jcraft.jsch.JSchException; +import com.jcraft.jsch.Session; import java.io.IOException; import java.io.OutputStream; @@ -76,7 +77,7 @@ this.session = session; } - protected Channel openExecChannel( String command ) { + protected Channel openExecChannel( String command ) throws JSchException { ChannelExec channel = (ChannelExec) session.openChannel( "exec" ); channel.setCommand( command ); @@ -97,7 +98,7 @@ } while (b > 0); } - public abstract void execute() throws IOException; + public abstract void execute() throws IOException, JSchException; public void setLogListener( LogListener aListener ) { listener = aListener; 1.3 +2 -2 ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java Index: Scp.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Scp.java 7 Mar 2003 14:53:36 -0000 1.2 +++ Scp.java 10 Mar 2003 10:05:43 -0000 1.3 @@ -201,7 +201,7 @@ if( failOnError ) { throw new BuildException(e); } else { - e.printStackTrace(); + log("Caught exception: " + e.getMessage(), Project.MSG_ERR); } } } @@ -317,7 +317,7 @@ } private Directory createDirectory( FileSet set ) { - DirectoryScanner scanner = set.getDirectoryScanner( project ); + DirectoryScanner scanner = set.getDirectoryScanner( getProject() ); Directory root = new Directory( scanner.getBasedir() ); String[] files = scanner.getIncludedFiles(); for (int j = 0; j < files.length; j++) { 1.2 +1 -1 ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java Index: ScpFromMessage.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ScpFromMessage.java 6 Mar 2003 12:42:44 -0000 1.1 +++ ScpFromMessage.java 10 Mar 2003 10:05:43 -0000 1.2 @@ -76,7 +76,7 @@ this.isRecursive = recursive; } - public void execute() throws IOException { + public void execute() throws IOException, JSchException { String command = "scp -f "; if( isRecursive ) command += "-r "; 1.2 +5 -4 ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessage.java Index: ScpToMessage.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ScpToMessage.java 6 Mar 2003 12:42:44 -0000 1.1 +++ ScpToMessage.java 10 Mar 2003 10:05:43 -0000 1.2 @@ -54,8 +54,9 @@ package org.apache.tools.ant.taskdefs.optional.ssh; -import com.jcraft.jsch.Session; import com.jcraft.jsch.Channel; +import com.jcraft.jsch.Session; +import com.jcraft.jsch.JSchException; import java.io.*; import java.util.*; @@ -85,7 +86,7 @@ this.remotePath = aRemotePath; } - public void execute() throws IOException { + public void execute() throws IOException, JSchException { if( directoryList != null ) { doMultipleTransfer(); } @@ -95,7 +96,7 @@ log("done.\n"); } - private void doSingleTransfer() throws IOException { + private void doSingleTransfer() throws IOException, JSchException { String cmd = "scp -t " + remotePath; Channel channel = openExecChannel( cmd ); try { @@ -114,7 +115,7 @@ } } - private void doMultipleTransfer() throws IOException { + private void doMultipleTransfer() throws IOException, JSchException { Channel channel = openExecChannel( "scp -d -t " + remotePath ); try { OutputStream out = channel.getOutputStream();