LUCENE-7345: MDW now disables VirusCheckingFS while trying to corrupt files

This commit is contained in:
Mike McCandless 2016-06-21 04:50:09 -04:00
parent 3a9019e020
commit 113afcf024
1 changed files with 11 additions and 0 deletions

View File

@ -292,6 +292,17 @@ public class MockDirectoryWrapper extends BaseDirectoryWrapper {
} }
public synchronized void corruptFiles(Collection<String> files) throws IOException { public synchronized void corruptFiles(Collection<String> files) throws IOException {
boolean disabled = TestUtil.disableVirusChecker(in);
try {
_corruptFiles(files);
} finally {
if (disabled) {
TestUtil.enableVirusChecker(in);
}
}
}
private synchronized void _corruptFiles(Collection<String> files) throws IOException {
// Must make a copy because we change the incoming unsyncedFiles // Must make a copy because we change the incoming unsyncedFiles
// when we create temp files, delete, etc., below: // when we create temp files, delete, etc., below:
final List<String> filesToCorrupt = new ArrayList<>(files); final List<String> filesToCorrupt = new ArrayList<>(files);