gokaai commented on code in PR #12872: URL: https://github.com/apache/lucene/pull/12872#discussion_r1440324120
########## lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java: ########## @@ -389,13 +389,26 @@ private static void parseSegmentInfos( } long totalDocs = 0; + SegmentInfo info; for (int seg = 0; seg < numSegments; seg++) { String segName = input.readString(); byte[] segmentID = new byte[StringHelper.ID_LENGTH]; input.readBytes(segmentID, 0, segmentID.length); Codec codec = readCodec(input); - SegmentInfo info = - codec.segmentInfoFormat().read(directory, segName, segmentID, IOContext.READ); + try { + info = codec.segmentInfoFormat().read(directory, segName, segmentID, IOContext.READ); + } catch (Throwable t) { + if (infoStream != null) { + message(t.getMessage()); + } + if (t instanceof NoSuchFileException || t instanceof FileNotFoundException) { + throw new CorruptSegmentInfoException( + "segment info file: " + segName + ".si cannot be read - it may be missing or corrupt", + input); + } else { + throw t; Review Comment: I tried catching all Throwable t here but it causes `TestIndexWrtier#testThreadInterruptDeadlock` to fail as it doesn't throw `ThreadInterruptExceptions` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org