diff --git a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/fs/FileManager.java b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/fs/FileManager.java index c964276a3..dbc9c50ea 100644 --- a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/fs/FileManager.java +++ b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/fs/FileManager.java @@ -271,16 +271,12 @@ private static File getTempDir() final File systemTempDir = new File(systemTempDirPath); final File tempDir = new File(systemTempDir, dirName); - - int retrieveTempDirAttemptLimit = 5; - for (int i = 0; i < retrieveTempDirAttemptLimit; i++) { - if (tempDir.exists() || tempDir.mkdirs()) - { - return tempDir; - } + if (!tempDir.exists() && !tempDir.mkdirs() && !tempDir.exists()) + { + throw new RuntimeException("Failed to create temp directory: " + tempDir); } - throw new RuntimeException("Failed to create temp directory: " + tempDir); + return tempDir; } } } diff --git a/engines/base/src/main/java/org/alfresco/transform/base/fs/FileManager.java b/engines/base/src/main/java/org/alfresco/transform/base/fs/FileManager.java index e525ab05e..b5cf4f37b 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/fs/FileManager.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/fs/FileManager.java @@ -230,16 +230,12 @@ private static File getTempDir() final File systemTempDir = new File(systemTempDirPath); final File tempDir = new File(systemTempDir, dirName); - - int retrieveTempDirAttemptLimit = 5; - for (int i = 0; i < retrieveTempDirAttemptLimit; i++) { - if (tempDir.exists() || tempDir.mkdirs()) - { - return tempDir; - } + if (!tempDir.exists() && !tempDir.mkdirs()) + { + throw new RuntimeException("Failed to create temp directory: " + tempDir); } - throw new RuntimeException("Failed to create temp directory: " + tempDir); + return tempDir; } } }