import org.simantics.acorn.exception.InvalidHeadStateException;
import org.simantics.databoard.Bindings;
import org.simantics.acorn.exception.InvalidHeadStateException;
import org.simantics.databoard.Bindings;
import org.simantics.databoard.binding.mutable.MutableVariant;
import org.simantics.databoard.serialization.Serializer;
import org.simantics.databoard.util.binary.BinaryMemory;
import org.simantics.databoard.binding.mutable.MutableVariant;
import org.simantics.databoard.serialization.Serializer;
import org.simantics.databoard.util.binary.BinaryMemory;
public ArrayList<String> cs = new ArrayList<>();
// public ArrayList<String> ccs = new ArrayList<String>();
public ArrayList<String> cs = new ArrayList<>();
// public ArrayList<String> ccs = new ArrayList<String>();
public static HeadState load(Path directory) throws InvalidHeadStateException {
Path f = directory.resolve(HEAD_STATE);
public static HeadState load(Path directory) throws InvalidHeadStateException {
Path f = directory.resolve(HEAD_STATE);
byte[] bytes = Files.readAllBytes(f);
MessageDigest sha1 = MessageDigest.getInstance(SHA_1);
int digestLength = sha1.getDigestLength();
byte[] bytes = Files.readAllBytes(f);
MessageDigest sha1 = MessageDigest.getInstance(SHA_1);
int digestLength = sha1.getDigestLength();
sha1.update(bytes, digestLength, bytes.length - digestLength);
byte[] newChecksum = sha1.digest();
if (!Arrays.equals(newChecksum, Arrays.copyOfRange(bytes, 0, digestLength))) {
sha1.update(bytes, digestLength, bytes.length - digestLength);
byte[] newChecksum = sha1.digest();
if (!Arrays.equals(newChecksum, Arrays.copyOfRange(bytes, 0, digestLength))) {
sha1.update(bytes, digestLength, bytes.length - digestLength);
byte[] newChecksum = sha1.digest();
if (!Arrays.equals(newChecksum, Arrays.copyOfRange(bytes, 0, digestLength))) {
sha1.update(bytes, digestLength, bytes.length - digestLength);
byte[] newChecksum = sha1.digest();
if (!Arrays.equals(newChecksum, Arrays.copyOfRange(bytes, 0, digestLength))) {
- throw new InvalidHeadStateException(
- "Checksum " + Arrays.toString(newChecksum) + " does not match excpected "
- + Arrays.toString(Arrays.copyOfRange(bytes, 0, digestLength)) + " for " + headState.toAbsolutePath());
+ LOGGER.error("Checksum " + Arrays.toString(newChecksum) + " does not match excpected " + Arrays.toString(Arrays.copyOfRange(bytes, 0, digestLength)) + " for " + headState.toAbsolutePath());
+ return false;