[FIX] Дополнительное логгирование в verifyHDir

This commit is contained in:
Gravit 2019-04-27 20:27:22 +07:00
parent b1fe3cf2a9
commit 24a453f338
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -545,12 +545,12 @@ public static void verifyHDir(Path dir, HashedDir hdir, FileNameMatcher matcher,
{ {
AtomicBoolean isFoundFile = new AtomicBoolean(false); AtomicBoolean isFoundFile = new AtomicBoolean(false);
diff.extra.walk(File.separator, (e,k,v) -> { diff.extra.walk(File.separator, (e,k,v) -> {
if(v.getType().equals(HashedEntry.Type.FILE)) isFoundFile.set(true); if(v.getType().equals(HashedEntry.Type.FILE)) { LogHelper.error("Extra file %s", e); isFoundFile.set(true); }
LogHelper.error("Extra %s", e); else LogHelper.error("Extra %s", e);
}); });
diff.mismatch.walk(File.separator, (e,k,v) -> { diff.mismatch.walk(File.separator, (e,k,v) -> {
if(v.getType().equals(HashedEntry.Type.FILE)) isFoundFile.set(true); if(v.getType().equals(HashedEntry.Type.FILE)) { LogHelper.error("Mismatch file %s", e); isFoundFile.set(true); }
LogHelper.error("Mismatch %s", e); else LogHelper.error("Mismatch %s", e);
}); });
if(isFoundFile.get()) throw new SecurityException(String.format("Forbidden modification: '%s'", IOHelper.getFileName(dir))); if(isFoundFile.get()) throw new SecurityException(String.format("Forbidden modification: '%s'", IOHelper.getFileName(dir)));
} }