Skip to content

Commit

Permalink
Catch UncheckedIOException during PCES file copy. (#10083)
Browse files Browse the repository at this point in the history
Signed-off-by: Cody Littley <cody@swirldslabs.com>
  • Loading branch information
cody-littley committed Nov 22, 2023
1 parent 2041571 commit 337a719
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -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;
Expand Down Expand Up @@ -92,7 +93,9 @@ public static void copyPreconsensusEventStreamFilesRetryOnFailure(
platformContext, selfId, temporaryDirectory, minimumGenerationNonAncient));

return;
} catch (final IOException e) {
} catch (final IOException | UncheckedIOException e) {

Check warning on line 96 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/event/preconsensus/BestEffortPreconsensusEventFileCopy.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/event/preconsensus/BestEffortPreconsensusEventFileCopy.java#L96

Added line #L96 was not covered by tests
// 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 {
Expand Down

0 comments on commit 337a719

Please sign in to comment.