From 7f14ab906332b6da00a33d16ce813406e200be62 Mon Sep 17 00:00:00 2001 From: ribeaudc <ribeaudc> Date: Tue, 3 Jun 2008 05:48:58 +0000 Subject: [PATCH] fix: - ETL server Unit tests. SVN: 6416 --- .../cisd/common/exceptions/StopException.java | 1 + .../common/process/FileRenamingCallable.java | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/common/source/java/ch/systemsx/cisd/common/exceptions/StopException.java b/common/source/java/ch/systemsx/cisd/common/exceptions/StopException.java index 77a93f826ad..8024ee680d1 100644 --- a/common/source/java/ch/systemsx/cisd/common/exceptions/StopException.java +++ b/common/source/java/ch/systemsx/cisd/common/exceptions/StopException.java @@ -21,6 +21,7 @@ package ch.systemsx.cisd.common.exceptions; * <p> * This is usually triggered by interrupting the thread that the work package is processed in and * regularly checking with {@link #check()}. + * </p> * * @author Bernd Rinn */ diff --git a/common/source/java/ch/systemsx/cisd/common/process/FileRenamingCallable.java b/common/source/java/ch/systemsx/cisd/common/process/FileRenamingCallable.java index e5d935731f4..a468aa7167f 100644 --- a/common/source/java/ch/systemsx/cisd/common/process/FileRenamingCallable.java +++ b/common/source/java/ch/systemsx/cisd/common/process/FileRenamingCallable.java @@ -59,19 +59,22 @@ public final class FileRenamingCallable implements Callable<Boolean> operationLog.error(String.format( "Path '%s' doesn't exist, so it can't be moved to '%s'.", sourceFile, destinationFile)); - // Nothing to do here. So exit the looping by returning true. - return true; + return false; } if (destinationFile.exists()) { operationLog.error(String.format("Destination path '%s' already exists.", destinationFile)); - // Nothing to do here. So exit the looping by returning true. - return true; + return false; } - operationLog.warn(String.format("Moving path '%s' to directory '%s' failed (attempt %d).", - sourceFile, destinationFile, ++failures)); final boolean renamed = sourceFile.renameTo(destinationFile); - return renamed ? true : null; + if (renamed == false) + { + operationLog.warn(String.format( + "Moving path '%s' to directory '%s' failed (attempt %d).", sourceFile, + destinationFile, ++failures)); + return null; + } + return true; } } \ No newline at end of file -- GitLab