mirror of https://github.com/apache/lucene.git
- Small fixes from Bernhard Messer (http://issues.apache.org/bugzilla/show_bug.cgi?id=30522)
PR: 30522 Obtained from: Submitted by: Bernhard Messer Reviewed by: Otis Gospodnetic git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150443 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bcaf26108e
commit
83d745ab0c
|
@ -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$
|
||||
*/
|
||||
class TermVectorsReader {
|
||||
private FieldInfos fieldInfos;
|
||||
|
@ -41,12 +60,14 @@ class TermVectorsReader {
|
|||
|
||||
}
|
||||
|
||||
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 @@ class TermVectorsReader {
|
|||
// 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];
|
||||
|
|
|
@ -1,5 +1,21 @@
|
|||
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.OutputStream;
|
||||
import org.apache.lucene.util.StringHelper;
|
||||
|
@ -29,6 +45,9 @@ import java.util.Vector;
|
|||
writer.closeDocument()
|
||||
}
|
||||
</CODE>
|
||||
*
|
||||
* @version $Id$
|
||||
*
|
||||
*/
|
||||
final class TermVectorsWriter {
|
||||
public static final int FORMAT_VERSION = 1;
|
||||
|
|
Loading…
Reference in New Issue