]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Check head.state file existence before validating its integrity 32/532/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 17 May 2017 13:26:41 +0000 (16:26 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 17 May 2017 13:26:41 +0000 (16:26 +0300)
This prevents unnecessary NoSuchFileExceptions from being logged at
startup.

refs #7124

Change-Id: I500c937ec8894f6c97dcfe73b01efc4adc9b59a6

bundles/org.simantics.acorn/src/org/simantics/acorn/HeadState.java

index ea54a418578c13dd335e6054ae547e51c4424092..106134264c606cc1d3ded07199ec5b1688569e7a 100644 (file)
@@ -99,6 +99,8 @@ public class HeadState {
     }
 
     public static boolean validateHeadStateIntegrity(Path headState) {
+        if (!Files.exists(headState))
+            return false;
         try {
             byte[] bytes = Files.readAllBytes(headState);
             MessageDigest sha1 = MessageDigest.getInstance(SHA_1);