From fe58b6f3a27e1520054f74f06c3d7c2042ff4f79 Mon Sep 17 00:00:00 2001 From: Namgyu Kim Date: Mon, 10 Jun 2019 01:56:34 +0900 Subject: [PATCH] LUCENE-8812: disable Java 9 try-with-resources style in TestKoreanNumberFilter Signed-off-by: Namgyu Kim --- .../lucene/analysis/ko/TestKoreanNumberFilter.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lucene/analysis/nori/src/test/org/apache/lucene/analysis/ko/TestKoreanNumberFilter.java b/lucene/analysis/nori/src/test/org/apache/lucene/analysis/ko/TestKoreanNumberFilter.java index 25348234193..33c1c06c3f4 100644 --- a/lucene/analysis/nori/src/test/org/apache/lucene/analysis/ko/TestKoreanNumberFilter.java +++ b/lucene/analysis/nori/src/test/org/apache/lucene/analysis/ko/TestKoreanNumberFilter.java @@ -48,9 +48,13 @@ public class TestKoreanNumberFilter extends BaseTokenStreamTestCase { if (is == null) { throw new RuntimeException("Cannot find userdict.txt in test classpath!"); } - Reader reader = new InputStreamReader(is, StandardCharsets.UTF_8); - try (reader) { - return UserDictionary.open(reader); + try { + try { + Reader reader = new InputStreamReader(is, StandardCharsets.UTF_8); + return UserDictionary.open(reader); + } finally { + is.close(); + } } catch (IOException ioe) { throw new RuntimeException(ioe); }