Repository: jclouds Updated Branches: refs/heads/update-PR-841 [created] 730d24478
JCLOUDS-827 updating sshj Moved sshj to the new com.hierynomus version. This only needed a minor code change due to a method removal. However, due to the changed groupId but the same package declarations maven treats them as different and does not exclude the versions imported by jsch.agentproxy so these are manually excluded and updated to the 0.0.9 versions Also sshj is depends on a newer version of BouncyCastle. This has been updated to 1.51. The inclusion of the extended version in the bouncycastle driver causes a duplicate class clash. This has been excluded in the project pom. Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/e6666938 Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/e6666938 Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/e6666938 Branch: refs/heads/update-PR-841 Commit: e66669381f37be1e0243dc9f7ab5aa262a27d031 Parents: 4f32e86 Author: Stuart Hendren <[email protected]> Authored: Mon Aug 10 16:18:11 2015 +0100 Committer: Andrew Phillips <[email protected]> Committed: Tue Aug 11 11:25:21 2015 -0400 ---------------------------------------------------------------------- drivers/bouncycastle/pom.xml | 2 +- drivers/jsch/pom.xml | 4 +- drivers/sshj/pom.xml | 23 ++++++++--- .../java/org/jclouds/sshj/SshjSshClient.java | 40 ++++++++++++-------- project/pom.xml | 17 ++++++++- 5 files changed, 61 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds/blob/e6666938/drivers/bouncycastle/pom.xml ---------------------------------------------------------------------- diff --git a/drivers/bouncycastle/pom.xml b/drivers/bouncycastle/pom.xml index d673615..e82527c 100644 --- a/drivers/bouncycastle/pom.xml +++ b/drivers/bouncycastle/pom.xml @@ -62,7 +62,7 @@ <dependency> <groupId>org.bouncycastle</groupId> <artifactId>bcprov-ext-jdk15on</artifactId> - <version>1.49</version> + <version>1.51</version> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/jclouds/blob/e6666938/drivers/jsch/pom.xml ---------------------------------------------------------------------- diff --git a/drivers/jsch/pom.xml b/drivers/jsch/pom.xml index 6aabe35..dcd17b2 100644 --- a/drivers/jsch/pom.xml +++ b/drivers/jsch/pom.xml @@ -90,12 +90,12 @@ <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch.agentproxy.jsch</artifactId> - <version>0.0.8</version> + <version>0.0.9</version> </dependency> <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch.agentproxy.connector-factory</artifactId> - <version>0.0.8</version> + <version>0.0.9</version> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/jclouds/blob/e6666938/drivers/sshj/pom.xml ---------------------------------------------------------------------- diff --git a/drivers/sshj/pom.xml b/drivers/sshj/pom.xml index 4bbfbbf..752a59b 100644 --- a/drivers/sshj/pom.xml +++ b/drivers/sshj/pom.xml @@ -87,15 +87,14 @@ <scope>test</scope> </dependency> <dependency> - <groupId>net.schmizz</groupId> + <groupId>com.hierynomus</groupId> <artifactId>sshj</artifactId> - <version>0.8.1</version> </dependency> <!-- required by sshj --> <dependency> <groupId>org.bouncycastle</groupId> <artifactId>bcpkix-jdk15on</artifactId> - <version>1.49</version> + <version>1.51</version> <exclusions> <!-- provided by the jclouds-bouncycastle driver --> <exclusion> @@ -107,12 +106,26 @@ <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch.agentproxy.sshj</artifactId> - <version>0.0.8</version> + <version>0.0.9</version> + <exclusions> + <!-- Required due to sshj groupId change --> + <exclusion> + <groupId>net.schmizz</groupId> + <artifactId>sshj</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch.agentproxy.connector-factory</artifactId> - <version>0.0.8</version> + <version>0.0.9</version> + <exclusions> + <exclusion> + <!-- Required due to sshj groupId change --> + <groupId>net.schmizz</groupId> + <artifactId>sshj</artifactId> + </exclusion> + </exclusions> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/jclouds/blob/e6666938/drivers/sshj/src/main/java/org/jclouds/sshj/SshjSshClient.java ---------------------------------------------------------------------- diff --git a/drivers/sshj/src/main/java/org/jclouds/sshj/SshjSshClient.java b/drivers/sshj/src/main/java/org/jclouds/sshj/SshjSshClient.java index b1f60b5..1f7fd8e 100644 --- a/drivers/sshj/src/main/java/org/jclouds/sshj/SshjSshClient.java +++ b/drivers/sshj/src/main/java/org/jclouds/sshj/SshjSshClient.java @@ -41,19 +41,6 @@ import javax.annotation.PreDestroy; import javax.annotation.Resource; import javax.inject.Named; -import net.schmizz.sshj.SSHClient; -import net.schmizz.sshj.common.IOUtils; -import net.schmizz.sshj.connection.ConnectionException; -import net.schmizz.sshj.connection.channel.direct.PTYMode; -import net.schmizz.sshj.connection.channel.direct.Session; -import net.schmizz.sshj.connection.channel.direct.Session.Command; -import net.schmizz.sshj.connection.channel.direct.SessionChannel; -import net.schmizz.sshj.sftp.SFTPClient; -import net.schmizz.sshj.sftp.SFTPException; -import net.schmizz.sshj.transport.TransportException; -import net.schmizz.sshj.userauth.UserAuthException; -import net.schmizz.sshj.xfer.InMemorySourceFile; - import org.jclouds.compute.domain.ExecChannel; import org.jclouds.compute.domain.ExecResponse; import org.jclouds.domain.LoginCredentials; @@ -79,6 +66,19 @@ import com.google.common.net.HostAndPort; import com.google.inject.Inject; import com.jcraft.jsch.agentproxy.Connector; +import net.schmizz.sshj.SSHClient; +import net.schmizz.sshj.common.IOUtils; +import net.schmizz.sshj.connection.ConnectionException; +import net.schmizz.sshj.connection.channel.direct.PTYMode; +import net.schmizz.sshj.connection.channel.direct.Session; +import net.schmizz.sshj.connection.channel.direct.Session.Command; +import net.schmizz.sshj.connection.channel.direct.SessionChannel; +import net.schmizz.sshj.sftp.RemoteFile; +import net.schmizz.sshj.sftp.SFTPClient; +import net.schmizz.sshj.sftp.SFTPException; +import net.schmizz.sshj.transport.TransportException; +import net.schmizz.sshj.userauth.UserAuthException; +import net.schmizz.sshj.xfer.InMemorySourceFile; /** * This class needs refactoring. It is not thread safe. */ @@ -271,8 +271,18 @@ public class SshjSshClient implements SshClient { @Override public Payload create() throws Exception { sftp = acquire(sftpConnection); - return Payloads.newInputStreamPayload(new CloseFtpChannelOnCloseInputStream(sftp.getSFTPEngine().open(path) - .getInputStream(), sftp)); + final RemoteFile remoteFile = sftp.getSFTPEngine().open(path); + final InputStream in = remoteFile.new RemoteFileInputStream() { + @Override + public void close() throws IOException { + try { + super.close(); + } finally { + remoteFile.close(); + } + } + }; + return Payloads.newInputStreamPayload(new CloseFtpChannelOnCloseInputStream(in, sftp)); } @Override http://git-wip-us.apache.org/repos/asf/jclouds/blob/e6666938/project/pom.xml ---------------------------------------------------------------------- diff --git a/project/pom.xml b/project/pom.xml index b23a93f..aa152cd 100644 --- a/project/pom.xml +++ b/project/pom.xml @@ -232,6 +232,7 @@ <auto-service.version>1.0-rc2</auto-service.version> <auto-value.version>1.1</auto-value.version> <java-xmlbuilder.version>1.1</java-xmlbuilder.version> + <sshj.version>0.12.0</sshj.version> <http.proxyHost /> <http.proxyPort /> <jclouds.wire.httpstream.url>http://archive.apache.org/dist/commons/logging/binaries/commons-logging-1.1.1-bin.tar.gz</jclouds.wire.httpstream.url> @@ -361,6 +362,18 @@ <artifactId>java-xmlbuilder</artifactId> <version>${java-xmlbuilder.version}</version> </dependency> + <dependency> + <groupId>com.hierynomus</groupId> + <artifactId>sshj</artifactId> + <version>${sshj.version}</version> + <exclusions> + <!-- provided by the jclouds-bouncycastle driver --> + <exclusion> + <groupId>org.bouncycastle</groupId> + <artifactId>bcprov-jdk15on</artifactId> + </exclusion> + </exclusions> + </dependency> </dependencies> </dependencyManagement> <dependencies> @@ -577,12 +590,12 @@ <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch.agentproxy.core</artifactId> - <version>0.0.8</version> + <version>0.0.9</version> </dependency> <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch.agentproxy.connector-factory</artifactId> - <version>0.0.8</version> + <version>0.0.9</version> </dependency> </conflictingDependencies> <packages>
