diff --git a/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java b/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java index 193d877b076..4f7de29b70f 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java +++ b/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java @@ -292,6 +292,17 @@ public class MockDirectoryWrapper extends BaseDirectoryWrapper { } public synchronized void corruptFiles(Collection files) throws IOException { + boolean disabled = TestUtil.disableVirusChecker(in); + try { + _corruptFiles(files); + } finally { + if (disabled) { + TestUtil.enableVirusChecker(in); + } + } + } + + private synchronized void _corruptFiles(Collection files) throws IOException { // Must make a copy because we change the incoming unsyncedFiles // when we create temp files, delete, etc., below: final List filesToCorrupt = new ArrayList<>(files);