From a068b8371956c6cdacaef05b6c5f47ed59b7afe9 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Fri, 1 May 2009 22:08:43 +0000 Subject: [PATCH] LUCENE-1623: fix case that was swallowing IOException; use .clear() instead of creating new ArrayList/HashMap git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@770839 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/lucene/index/FieldInfos.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/java/org/apache/lucene/index/FieldInfos.java b/src/java/org/apache/lucene/index/FieldInfos.java index a46a5fd402b..e6b079c55b7 100644 --- a/src/java/org/apache/lucene/index/FieldInfos.java +++ b/src/java/org/apache/lucene/index/FieldInfos.java @@ -50,8 +50,8 @@ final class FieldInfos { static final byte STORE_PAYLOADS = 0x20; static final byte OMIT_TERM_FREQ_AND_POSITIONS = 0x40; - private ArrayList byNumber = new ArrayList(); - private HashMap byName = new HashMap(); + private final ArrayList byNumber = new ArrayList(); + private final HashMap byName = new HashMap(); private int format; FieldInfos() { } @@ -75,14 +75,18 @@ final class FieldInfos { // encoding; retry with input set to pre-utf8 input.seek(0); input.setModifiedUTF8StringsMode(); - byNumber = new ArrayList(); - byName = new HashMap(); + byNumber.clear(); + byName.clear(); try { read(input, name); } catch (Throwable t) { // Ignore any new exception & throw original IOE throw ioe; } + } else { + // The IOException cannot be caused by + // LUCENE-1623, so re-throw it + throw ioe; } } } finally {