LUCENE-4456: fix MDW to print any exc when processing ghost files

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1393464 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2012-10-03 12:42:28 +00:00
parent 1e05df4461
commit 23ff344f82

View File

@ -615,9 +615,14 @@ public class MockDirectoryWrapper extends BaseDirectoryWrapper {
if (LuceneTestCase.VERBOSE) {
System.out.println("MDW: Unreferenced check: Ignoring segments file: " + file + " that we could not delete.");
}
try {
SegmentInfos sis = new SegmentInfos();
try {
sis.read(delegate, file);
} catch (IOException ioe) {
// OK: likely some of the .si files were deleted
}
try {
Set<String> ghosts = new HashSet<String>(sis.files(delegate, false));
for (String s : ghosts) {
if (endSet.contains(s) && !startSet.contains(s)) {
@ -629,7 +634,10 @@ public class MockDirectoryWrapper extends BaseDirectoryWrapper {
startSet.add(s);
}
}
} catch (Throwable ignore) {}
} catch (Throwable t) {
System.err.println("ERROR processing leftover segments file " + file + ":");
t.printStackTrace();
}
}
}