LUCENE-3606: Simplyfy more

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3606@1211718 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2011-12-08 00:04:32 +00:00
parent 96576daf53
commit a354e99e56
1 changed files with 6 additions and 10 deletions

View File

@ -39,10 +39,10 @@ import org.apache.lucene.util.StringHelper;
public class Lucene40NormsReader extends NormsReader { public class Lucene40NormsReader extends NormsReader {
// this would be replaced by Source/SourceCache in a dv impl. // this would be replaced by Source/SourceCache in a dv impl.
// for now we have our own mini-version // for now we have our own mini-version
Map<String,Norm> norms = new HashMap<String,Norm>(); final Map<String,Norm> norms = new HashMap<String,Norm>();
// any .nrm or .sNN files we have open at any time. // any .nrm or .sNN files we have open at any time.
// TODO: just a list, and double-close() separate norms files? // TODO: just a list, and double-close() separate norms files?
Set<IndexInput> openFiles = new MapBackedSet<IndexInput>(new IdentityHashMap<IndexInput,Boolean>()); final Set<IndexInput> openFiles = new MapBackedSet<IndexInput>(new IdentityHashMap<IndexInput,Boolean>());
// points to a singleNormFile // points to a singleNormFile
IndexInput singleNormStream; IndexInput singleNormStream;
final int maxdoc; final int maxdoc;
@ -106,12 +106,10 @@ public class Lucene40NormsReader extends NormsReader {
success = true; success = true;
} finally { } finally {
if (!success) { if (!success) {
if (openFiles != null) {
IOUtils.closeWhileHandlingException(openFiles); IOUtils.closeWhileHandlingException(openFiles);
} }
} }
} }
}
@Override @Override
public byte[] norms(String name) throws IOException { public byte[] norms(String name) throws IOException {
@ -123,12 +121,10 @@ public class Lucene40NormsReader extends NormsReader {
@Override @Override
public void close() throws IOException { public void close() throws IOException {
try { try {
if (openFiles != null) {
IOUtils.close(openFiles); IOUtils.close(openFiles);
}
} finally { } finally {
norms = null; norms.clear();
openFiles = null; openFiles.clear();
} }
} }