Index: TermVectorsReader.java =================================================================== RCS file: /home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/index/TermVectorsReader.java,v retrieving revision 1.2 diff -u -r1.2 TermVectorsReader.java --- TermVectorsReader.java 6 Aug 2004 20:50:00 -0000 1.2 +++ TermVectorsReader.java 8 Aug 2004 11:58:09 -0000 @@ -1,11 +1,30 @@ package org.apache.lucene.index; +/** + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import org.apache.lucene.store.Directory; import org.apache.lucene.store.InputStream; import java.io.IOException; -/** TODO: relax synchro! +/** + * FIXME: relax synchro! + * + * @version $Id: Exp $ */ class TermVectorsReader { private FieldInfos fieldInfos; @@ -41,12 +60,14 @@ } - synchronized void close() throws IOException { - // why don't we trap the exception and at least make sure that - // all streams that we can close are closed? - if (tvx != null) tvx.close(); - if (tvd != null) tvd.close(); - if (tvf != null) tvf.close(); + void close() throws IOException { + // make all effort to close up. Keep the first exception + // and throw it as a new one. + IOException keep = null; + if (tvx != null) try { tvx.close(); } catch (IOException e) { if (keep == null) keep = e; } + if (tvd != null) try { tvd.close(); } catch (IOException e) { if (keep == null) keep = e; } + if (tvf != null) try { tvf.close(); } catch (IOException e) { if (keep == null) keep = e; } + if (keep != null) throw (IOException) keep.fillInStackTrace(); } /** @@ -188,8 +209,8 @@ // If no terms - return a constant empty termvector if (numTerms == 0) return new SegmentTermVector(field, null, null); - int length = numTerms + tvf.readVInt(); - + tvf.readVInt(); + String terms[] = new String[numTerms]; int termFreqs[] = new int[numTerms];