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 {
// this would be replaced by Source/SourceCache in a dv impl.
// 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.
// 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
IndexInput singleNormStream;
final int maxdoc;
@ -106,12 +106,10 @@ public class Lucene40NormsReader extends NormsReader {
success = true;
} finally {
if (!success) {
if (openFiles != null) {
IOUtils.closeWhileHandlingException(openFiles);
}
}
}
}
@Override
public byte[] norms(String name) throws IOException {
@ -123,12 +121,10 @@ public class Lucene40NormsReader extends NormsReader {
@Override
public void close() throws IOException {
try {
if (openFiles != null) {
IOUtils.close(openFiles);
}
} finally {
norms = null;
openFiles = null;
norms.clear();
openFiles.clear();
}
}