Code with Finding: |
class FieldInfos {
/**
* Construct a FieldInfos object using the directory and the name of the file
* IndexInput
* @param d The directory to open the IndexInput from
* @param name The name of the file to open the IndexInput from in the Directory
* @throws IOException
*/
FieldInfos(Directory d, String name) throws IOException {
IndexInput input = d.openInput(name);
try {
try {
read(input, name);
} catch (IOException ioe) {
if (format == FORMAT_PRE) {
// LUCENE-1623: FORMAT_PRE (before there was a
// format) may be 2.3.2 (pre-utf8) or 2.4.x (utf8)
// encoding; retry with input set to pre-utf8
input.seek(0);
input.setModifiedUTF8StringsMode();
byNumber.clear();
byName.clear();
try {
read(input, name);
} catch (Throwable t) {
// Ignore any new exception & throw original IOE
throw ioe;
}
} else {
// The IOException cannot be caused by
// LUCENE-1623, so re-throw it
throw ioe;
}
}
} finally {
input.close();
}
}
}
|