diff --git a/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/store/FileStoreRemote.java b/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/store/FileStoreRemote.java index 4dceeba8c73c42f6eb800e4b3ce899593476c3bf..b5aeba0915374f6447892a8be7b9bcff00b2ecc0 100644 --- a/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/store/FileStoreRemote.java +++ b/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/store/FileStoreRemote.java @@ -46,6 +46,9 @@ import ch.systemsx.cisd.datamover.filesystem.intf.IFileSysOperationsFactory; import ch.systemsx.cisd.datamover.filesystem.intf.IStoreCopier; /** + * Allows to operate on files by executing all file system operations on a remote machine with ssh + * command. + * * @author Tomasz Pylak */ public class FileStoreRemote extends AbstractFileStore @@ -406,7 +409,7 @@ public class FileStoreRemote extends AbstractFileStore { result.log(); } - if (result.isOK()) + if (result.isOK() && hasAnyOutput(result)) { final String findExecutable = result.getOutput().get(0); final String verCmd = getVersionCommand(findExec); @@ -424,6 +427,11 @@ public class FileStoreRemote extends AbstractFileStore return null; } + private static boolean hasAnyOutput(ProcessResult result) + { + return result.getOutput().size() > 0; + } + private boolean isGNUFind(List<String> output) { return output.size() > 0 && output.get(0).contains("GNU") && output.get(0).contains("find"); @@ -458,7 +466,7 @@ public class FileStoreRemote extends AbstractFileStore { result.log(); } - if (result.isOK()) + if (result.isOK() && hasAnyOutput(result)) { return result.getOutput().get(0); } else @@ -612,6 +620,10 @@ public class FileStoreRemote extends AbstractFileStore return String.format("Command '%s' failed with error exitval=%d, output=[%s]", result .getCommandLine(), result.getExitValue(), StringUtils.join(result.getOutput(), '\n')); + } else if (hasAnyOutput(result) == false) + { + return String.format("Command '%s' ended succesfully, but without any output.", result + .getCommandLine()); } else { return null;