You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Beard, Brian" <Br...@mybir.com> on 2007/12/21 21:00:00 UTC
org.apache.lucene.index.CheckIndex minor fix
I have used the org.apache.lucene.index.CheckIndex class in the trunk
version of the source which seems to work well.
There was one minor issue with it hanging on to the segment*'s file
after the method is called (w/o the fixing option).
There is one change I did which clears this up by a adding a finally
block to close the IndexInput.
/** old version from line 88 **/
try {
format = input.readInt();
} catch (Throwable t) {
out.println("ERROR: could not read segment file version in
directory");
t.printStackTrace(out);
return false;
}
/** updated version **/
try {
format = input.readInt();
} catch (Throwable t) {
out.println("ERROR: could not read segment file version in
directory");
t.printStackTrace(out);
return false;
} finally {
if (input != null) {
input.close();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: org.apache.lucene.index.CheckIndex minor fix
Posted by Michael McCandless <lu...@mikemccandless.com>.
Good catch! I will commit this. Thanks!
Mike
Beard, Brian wrote:
> I have used the org.apache.lucene.index.CheckIndex class in the trunk
> version of the source which seems to work well.
>
> There was one minor issue with it hanging on to the segment*'s file
> after the method is called (w/o the fixing option).
>
> There is one change I did which clears this up by a adding a finally
> block to close the IndexInput.
>
> /** old version from line 88 **/
> try {
> format = input.readInt();
> } catch (Throwable t) {
> out.println("ERROR: could not read segment file version in
> directory");
> t.printStackTrace(out);
> return false;
> }
>
> /** updated version **/
> try {
> format = input.readInt();
> } catch (Throwable t) {
> out.println("ERROR: could not read segment file version in
> directory");
> t.printStackTrace(out);
> return false;
> } finally {
> if (input != null) {
> input.close();
> }
> }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org