JAL-3628 Fix for slightly incorrect boolean usage to determine success when rolling...
authorBen Soares <b.soares@dundee.ac.uk>
Mon, 6 Jul 2020 14:43:37 +0000 (15:43 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Tue, 10 Nov 2020 18:54:29 +0000 (18:54 +0000)
src/jalview/io/BackupFiles.java

index 5594857..11d1a16 100644 (file)
@@ -431,7 +431,9 @@ public class BackupFiles
           {
             if (previousFile != null)
             {
-              ret = ret && moveFileToFile(backupfile_n, previousFile);
+              // using boolean '&' instead of '&&' as don't want moveFileToFile
+              // attempt to be conditional (short-circuit)
+              ret = ret & moveFileToFile(backupfile_n, previousFile);
             }
           }
 
@@ -549,7 +551,9 @@ public class BackupFiles
                     suffix, digits);
     Cache.log.debug("BACKUPFILES Moving old file [" + file
             + "] to latestBackupFilename [" + latestBackupFilename + "]");
-    ret |= moveFileToFile(file, new File(latestBackupFilename));
+    // using boolean '&' instead of '&&' as don't want moveFileToFile attempt to
+    // be conditional (short-circuit)
+    ret = ret & moveFileToFile(file, new File(latestBackupFilename));
     Cache.log.debug(
             "BACKUPFILES moving " + file + " to " + latestBackupFilename
                     + " was " + (ret ? "" : "NOT ") + "successful");