INT-2387 changed mkdir() method in Session to return boolean

This commit is contained in:
Oleg Zhurakousky
2012-01-05 17:13:54 -05:00
parent 58602d4802
commit 15e64b707b
6 changed files with 15 additions and 11 deletions

View File

@@ -255,11 +255,11 @@ public class FileTransferringMessageHandler<F> extends AbstractMessageHandler {
break;
}
else {
pathsToCreate.add(pathSegment);
pathsToCreate.add(0, pathSegment);
nextSeparatorIndex = pathSegment.lastIndexOf(remoteFileSeparator);
}
}
Collections.reverse(pathsToCreate);
for (String pathToCreate : pathsToCreate) {
if (logger.isDebugEnabled()){
logger.debug("Creating '" + pathToCreate + "'");

View File

@@ -155,8 +155,8 @@ public class CachingSessionFactory<F> implements SessionFactory<F>, DisposableBe
this.targetSession.rename(pathFrom, pathTo);
}
public void mkdir(String directory) throws IOException {
this.targetSession.mkdir(directory);
public boolean mkdir(String directory) throws IOException {
return this.targetSession.mkdir(directory);
}
public boolean exists(String path) throws IOException{

View File

@@ -39,7 +39,7 @@ public interface Session<T> {
void write(InputStream inputStream, String destination) throws IOException;
void mkdir(String directory) throws IOException;
boolean mkdir(String directory) throws IOException;
void rename(String pathFrom, String pathTo) throws IOException;

View File

@@ -262,7 +262,8 @@ public class RemoteFileOutboundGatewayTests {
public void write(InputStream inputStream, String destination)
throws IOException {
}
public void mkdir(String directory) throws IOException {
public boolean mkdir(String directory) throws IOException {
return true;
}
public void rename(String pathFrom, String pathTo)
throws IOException {
@@ -320,7 +321,8 @@ public class RemoteFileOutboundGatewayTests {
public void write(InputStream inputStream, String destination)
throws IOException {
}
public void mkdir(String directory) throws IOException {
public boolean mkdir(String directory) throws IOException {
return true;
}
public void rename(String pathFrom, String pathTo)
throws IOException {
@@ -375,7 +377,8 @@ public class RemoteFileOutboundGatewayTests {
public void write(InputStream inputStream, String destination)
throws IOException {
}
public void mkdir(String directory) throws IOException {
public boolean mkdir(String directory) throws IOException {
return true;
}
public void rename(String pathFrom, String pathTo)
throws IOException {

View File

@@ -119,8 +119,8 @@ class FtpSession implements Session<FTPFile> {
}
}
public void mkdir(String remoteDirectory) throws IOException {
this.client.makeDirectory(remoteDirectory);
public boolean mkdir(String remoteDirectory) throws IOException {
return this.client.makeDirectory(remoteDirectory);
}
public boolean exists(String path) throws IOException{

View File

@@ -151,13 +151,14 @@ class SftpSession implements Session<LsEntry> {
}
}
public void mkdir(String remoteDirectory) throws IOException {
public boolean mkdir(String remoteDirectory) throws IOException {
try {
this.channel.mkdir(remoteDirectory);
}
catch (SftpException e) {
throw new NestedIOException("failed to create remote directory '" + remoteDirectory + "'.", e);
}
return true;
}
public boolean exists(String path) {