3232import java .io .File ;
3333import java .io .IOException ;
3434import java .nio .file .Files ;
35+ import java .nio .file .NoSuchFileException ;
3536import java .util .ArrayList ;
3637import java .util .Arrays ;
3738import java .util .Comparator ;
@@ -81,7 +82,7 @@ public LogLoader(
8182 *
8283 * @return the offsets of the Log successfully loaded from disk
8384 */
84- public LoadedLogOffsets load () throws Exception {
85+ public LoadedLogOffsets load () throws IOException {
8586 // load all the log and index files.
8687 logSegments .close ();
8788 logSegments .clear ();
@@ -130,7 +131,7 @@ public LoadedLogOffsets load() throws Exception {
130131 * @throws LogSegmentOffsetOverflowException if the segment contains messages that cause index
131132 * offset overflow
132133 */
133- private int recoverSegment (LogSegment segment ) throws Exception {
134+ private int recoverSegment (LogSegment segment ) throws IOException {
134135 WriterStateManager writerStateManager =
135136 new WriterStateManager (
136137 logSegments .getTableBucket (),
@@ -264,7 +265,7 @@ private void removeAndDeleteSegments(Iterator<LogSegment> segmentsToDelete) {
264265 }
265266
266267 /** Loads segments from disk into the provided segments. */
267- private void loadSegmentFiles () throws Exception {
268+ private void loadSegmentFiles () throws IOException {
268269 File [] sortedFiles = logTabletDir .listFiles ();
269270 if (sortedFiles != null ) {
270271 Arrays .sort (sortedFiles , Comparator .comparing (File ::getName ));
@@ -288,8 +289,8 @@ private void loadSegmentFiles() throws Exception {
288289
289290 try {
290291 segment .sanityCheck (timeIndexFileNewlyCreated );
291- } catch (Exception e ) {
292- if (e instanceof NoSuchFieldException ) {
292+ } catch (IOException e ) {
293+ if (e instanceof NoSuchFileException ) {
293294 if (isCleanShutdown
294295 || segment .getBaseOffset () < recoveryPointCheckpoint ) {
295296 LOG .error (
0 commit comments