#13196, #13213: Fix test on windows to close file so it can be deleted after test run

This commit is contained in:
Uwe Schindler 2024-03-25 20:37:59 +01:00
parent a4055dae62
commit 61e5da3fe4
1 changed files with 5 additions and 4 deletions

View File

@ -109,10 +109,11 @@ public class TestMMapDirectory extends BaseDirectoryTestCase {
out.writeBytes(bytes, 0, bytes.length);
}
final IndexInput in = dir.openInput("test", IOContext.RANDOM);
final byte[] readBytes = new byte[size];
in.readBytes(readBytes, 0, readBytes.length);
assertArrayEquals(bytes, readBytes);
try (final IndexInput in = dir.openInput("test", IOContext.RANDOM)) {
final byte[] readBytes = new byte[size];
in.readBytes(readBytes, 0, readBytes.length);
assertArrayEquals(bytes, readBytes);
}
}
}
}