From ce98d98e085c7fbe878c5a723d20491aacbd913d Mon Sep 17 00:00:00 2001 From: Nikolay Chashnikov Date: Wed, 27 Jan 2021 00:45:17 +0300 Subject: [PATCH] [tests] close zip file to fix test on Windows GitOrigin-RevId: e337cacbfa873e6e56d251d4c185e7c4821eaff4 --- .../intellij/build/tasks/ReorderJarsTest.kt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/build/tasks/test/org/jetbrains/intellij/build/tasks/ReorderJarsTest.kt b/build/tasks/test/org/jetbrains/intellij/build/tasks/ReorderJarsTest.kt index 7f214c664883..376acc07933c 100644 --- a/build/tasks/test/org/jetbrains/intellij/build/tasks/ReorderJarsTest.kt +++ b/build/tasks/test/org/jetbrains/intellij/build/tasks/ReorderJarsTest.kt @@ -102,12 +102,18 @@ class ReorderJarsTest { } private fun testOldJarResourceImpl(file: Path, data: ByteArray) { - val loader = JdkZipResourceFile(file, true, false, false).preload(file) - assertThat(loader).isNotNull() - val bytes = loader!!.getBytes("org/jetbrains/annotations/Nullable.class") - assertThat(bytes).isNotNull() - assertThat(bytes).hasSize(548) - assertThat(data.contentEquals(bytes)).isTrue() + val resourceFile = JdkZipResourceFile(file, true, false, false) + try { + val loader = resourceFile.preload(file) + assertThat(loader).isNotNull() + val bytes = loader!!.getBytes("org/jetbrains/annotations/Nullable.class") + assertThat(bytes).isNotNull() + assertThat(bytes).hasSize(548) + assertThat(data.contentEquals(bytes)).isTrue() + } + finally { + resourceFile.close() + } } @Test