You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2024/03/25 19:38:09 UTC
(lucene) branch main updated: #13196, #13213: Fix test on windows to close file so it can be deleted after test run
This is an automated email from the ASF dual-hosted git repository.
uschindler pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new 61e5da3fe46 #13196, #13213: Fix test on windows to close file so it can be deleted after test run
61e5da3fe46 is described below
commit 61e5da3fe465480ef084ebb20599e1fc6658e67e
Author: Uwe Schindler <us...@apache.org>
AuthorDate: Mon Mar 25 20:37:59 2024 +0100
#13196, #13213: Fix test on windows to close file so it can be deleted after test run
---
.../core/src/test/org/apache/lucene/store/TestMMapDirectory.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lucene/core/src/test/org/apache/lucene/store/TestMMapDirectory.java b/lucene/core/src/test/org/apache/lucene/store/TestMMapDirectory.java
index edc5d369067..7bec6d5315c 100644
--- a/lucene/core/src/test/org/apache/lucene/store/TestMMapDirectory.java
+++ b/lucene/core/src/test/org/apache/lucene/store/TestMMapDirectory.java
@@ -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);
+ }
}
}
}