LUCENE-7011: use try-w-resources

This commit is contained in:
Mike McCandless 2016-02-03 10:19:26 -05:00
parent c6ec006e24
commit 3a889301c7
1 changed files with 19 additions and 18 deletions

View File

@ -67,7 +67,7 @@ class SimpleTextPointWriter extends PointWriter {
public void writeField(FieldInfo fieldInfo, PointReader values) throws IOException {
// We use the normal BKDWriter, but subclass to customize how it writes the index and blocks to disk:
BKDWriter writer = new BKDWriter(writeState.directory,
try (BKDWriter writer = new BKDWriter(writeState.directory,
writeState.segmentInfo.name,
fieldInfo.getPointDimensionCount(),
fieldInfo.getPointNumBytes(),
@ -152,7 +152,7 @@ class SimpleTextPointWriter extends PointWriter {
write(out, new BytesRef(bytes, 0, bytes.length).toString());
newline(out);
}
};
}) {
values.intersect(fieldInfo.name, new IntersectVisitor() {
@Override
@ -175,6 +175,7 @@ class SimpleTextPointWriter extends PointWriter {
indexFPs.put(fieldInfo.name, writer.finish(dataOut));
}
}
}
private void write(IndexOutput out, String s) throws IOException {
SimpleTextUtil.write(out, s, scratch);