[FEATURE] Отладочный вывод verifyHDir

This commit is contained in:
Gravit 2019-04-27 19:20:26 +07:00
parent 4597ea64e9
commit a26311be88
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -19,6 +19,7 @@
import ru.gravit.utils.helper.JVMHelper.OS;
import javax.swing.*;
import java.io.File;
import java.io.IOException;
import java.lang.ProcessBuilder.Redirect;
import java.lang.invoke.MethodHandle;
@ -537,9 +538,18 @@ public static void verifyHDir(Path dir, HashedDir hdir, FileNameMatcher matcher,
// Hash directory and compare (ignore update-only matcher entries, it will break offline-mode)
HashedDir currentHDir = new HashedDir(dir, matcher, true, digest);
if (!hdir.diff(currentHDir, matcher).isSame())
HashedDir.Diff diff = hdir.diff(currentHDir, matcher);
if (!diff.isSame())
{
diff.extra.walk(File.separator, (e,k,v) -> {
LogHelper.error("Extra %s", e);
});
diff.mismatch.walk(File.separator, (e,k,v) -> {
LogHelper.error("Mismatch %s", e);
});
throw new SecurityException(String.format("Forbidden modification: '%s'", IOHelper.getFileName(dir)));
}
}
private ClientLauncher() {
}