Closed cal101 closed 7 years ago
protected static void safeMove(final VFile sourceFile, final VFile targetFile, boolean deleteBeforeMove) { - if (deleteBeforeMove && targetFile.exists()) { - if (!targetFile.delete()) { - boolean exists = targetFile.exists(); - throw new UncheckedApplicationException("file: " + targetFile + " cant be deleted" - + " (file " + (exists ? "exists)" : "does not exist)") - - ); - } + if ((deleteBeforeMove && targetFile.exists()) && !targetFile.delete()) { + throw new UncheckedApplicationException("file: " + targetFile + " cant be deleted" + " (file " + (exists ? "exists)" : "does not exist)")); }
It happens due to an invalid order of visitors' execution. It is the same than issue #9.