diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/Copier.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/Copier.java index 0659f8579e8315c955b23280ee4c61f37db201d7..a5e671f34c7e7a406f05e43adbe764d55e28712e 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/Copier.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/plugins/standard/Copier.java @@ -128,15 +128,27 @@ public class Copier implements Serializable, IPostRegistrationDatasetHandler } if (renameToDataSetCode) { - String newFile = new File(destination, dataSetCode).getPath(); - ProcessResult result = - sshCommandExecutor.executeCommandRemotely("mv " + destinationFile.getPath() - + " " + newFile, DataSetCopier.SSH_TIMEOUT_MILLIS); - if (result.isOK() == false) + File newFile = new File(destination, dataSetCode); + if (host == null) + { + if (destinationFile.renameTo(newFile)) + { + operationLog.error("Moving of '" + destinationFile.getPath() + "' to '" + + newFile + "' failed."); + return Status.createError("couldn't move"); + } + } else { - operationLog.error("Remote move of '" + destinationFile.getPath() + "' to '" - + newFile + "' failed with exit value: " + result.getExitValue()); - return Status.createError("couldn't move"); + String newFilePath = newFile.getPath(); + ProcessResult result = + sshCommandExecutor.executeCommandRemotely("mv " + destinationFile.getPath() + + " " + newFilePath, DataSetCopier.SSH_TIMEOUT_MILLIS); + if (result.isOK() == false) + { + operationLog.error("Remote move of '" + destinationFile.getPath() + "' to '" + + newFilePath + "' failed with exit value: " + result.getExitValue()); + return Status.createError("couldn't move"); + } } } return status;