walkmod/walkmod-pmd-plugin

variable declaration lost on merging ifs

cal101 opened this issue · 1 comments

     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)"));
         }
rpau commented

It happens due to an invalid order of visitors' execution. It is the same than issue #9.