Skip to content

Commit

Permalink
Upgraded to SSHj 0.17.0 and fixed #182
Browse files Browse the repository at this point in the history
  • Loading branch information
hierynomus committed Jul 5, 2016
1 parent b005f57 commit b2809c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dependencies {
compile 'org.slf4j:jcl-over-slf4j:1.7.12'

// SSH
compile 'com.hierynomus:sshj:0.16.0'
compile 'com.hierynomus:sshj:0.17.0'
runtime 'com.jcraft:jzlib:1.0.7'
runtime 'org.bouncycastle:bcprov-jdk15on:1.52'

Expand Down
20 changes: 6 additions & 14 deletions src/main/java/com/xebialabs/overthere/ssh/SshSftpFile.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/**
* Copyright (c) 2008-2016, XebiaLabs B.V., All rights reserved.
*
*
* <p>
* <p>
* Overthere is licensed under the terms of the GPLv2
* <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most XebiaLabs Libraries.
* There are special exceptions to the terms and conditions of the GPLv2 as it is applied to
* this software, see the FLOSS License Exception
* <http://github.com/xebialabs/overthere/blob/master/LICENSE>.
*
* <p>
* This program is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; version 2
* of the License.
*
* <p>
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* <p>
* You should have received a copy of the GNU General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
Expand Down Expand Up @@ -140,15 +140,7 @@ public List<OverthereFile> listFiles() {
protected void copyFrom(OverthereFile source) {
SFTPFileTransfer fileTransfer = connection.getSharedSftpClient().getFileTransfer();
try {
// If the source is a directory and the name and the target name do not match, SFTP copies the
// directory into the destination, whereas we want to copy the contents into the destination.
if (source.isDirectory() && this.exists() && !source.getName().equals(this.getName())) {
for (OverthereFile overthereFile : source.listFiles()) {
fileTransfer.upload(new OverthereFileLocalSourceFile(overthereFile), getSftpPath());
}
} else {
fileTransfer.upload(new OverthereFileLocalSourceFile(source), getSftpPath());
}
fileTransfer.upload(new OverthereFileLocalSourceFile(source), getSftpPath());
} catch (IOException ioe) {
throw new RuntimeIOException(format("Cannot upload %s to %s", source, this), ioe);
}
Expand Down

0 comments on commit b2809c9

Please sign in to comment.