diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/event/preconsensus/BestEffortPreconsensusEventFileCopy.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/event/preconsensus/BestEffortPreconsensusEventFileCopy.java index e9a4c835be11..96e7f558e73e 100644 --- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/event/preconsensus/BestEffortPreconsensusEventFileCopy.java +++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/event/preconsensus/BestEffortPreconsensusEventFileCopy.java @@ -24,6 +24,7 @@ import com.swirlds.common.system.NodeId; import edu.umd.cs.findbugs.annotations.NonNull; import java.io.IOException; +import java.io.UncheckedIOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; @@ -92,7 +93,9 @@ public static void copyPreconsensusEventStreamFilesRetryOnFailure( platformContext, selfId, temporaryDirectory, minimumGenerationNonAncient)); return; - } catch (final IOException e) { + } catch (final IOException | UncheckedIOException e) { + // Note: Files.walk() sometimes throws an UncheckedIOException (?!!), so we have to catch both. + if (triesRemaining > 0) { logger.warn(STATE_TO_DISK.getMarker(), "Unable to copy PCES files. Retrying."); } else {