Browse Source

Upgrade to jsch-0.1.2

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274219 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
f3a31e1d17
4 changed files with 12 additions and 10 deletions
  1. +4
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java
  2. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java
  3. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java
  4. +5
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessage.java

+ 4
- 3
src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java View File

@@ -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 @@ public abstract class AbstractSshMessage {
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 @@ public abstract class AbstractSshMessage {
} while (b > 0);
}

public abstract void execute() throws IOException;
public abstract void execute() throws IOException, JSchException;

public void setLogListener( LogListener aListener ) {
listener = aListener;


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

@@ -201,7 +201,7 @@ public class Scp extends Task implements LogListener {
if( failOnError ) {
throw new BuildException(e);
} else {
e.printStackTrace();
log("Caught exception: " + e.getMessage(), Project.MSG_ERR);
}
}
}
@@ -317,7 +317,7 @@ public class Scp extends Task implements LogListener {
}

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
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java View File

@@ -76,7 +76,7 @@ public class ScpFromMessage extends AbstractSshMessage {
this.isRecursive = recursive;
}

public void execute() throws IOException {
public void execute() throws IOException, JSchException {
String command = "scp -f ";
if( isRecursive )
command += "-r ";


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

@@ -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 @@ public class ScpToMessage extends AbstractSshMessage {
this.remotePath = aRemotePath;
}

public void execute() throws IOException {
public void execute() throws IOException, JSchException {
if( directoryList != null ) {
doMultipleTransfer();
}
@@ -95,7 +96,7 @@ public class ScpToMessage extends AbstractSshMessage {
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 @@ public class ScpToMessage extends AbstractSshMessage {
}
}

private void doMultipleTransfer() throws IOException {
private void doMultipleTransfer() throws IOException, JSchException {
Channel channel = openExecChannel( "scp -d -t " + remotePath );
try {
OutputStream out = channel.getOutputStream();


Loading…
Cancel
Save