From d11631a942ff7fefcb1690d3827c17100a50dcf9 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Wed, 14 Dec 2022 19:18:43 +0100 Subject: [PATCH] Trying to handle file name parsing error in backup engine --- .../lib/paper/modules/backup/BackupCleaner.java | 9 ++++++++- .../lib/paper/modules/backup/CompressProcess.java | 7 ++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/backup/BackupCleaner.java b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/backup/BackupCleaner.java index 4d42ccb..e4b2203 100644 --- a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/backup/BackupCleaner.java +++ b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/modules/backup/BackupCleaner.java @@ -2,6 +2,7 @@ package fr.pandacube.lib.paper.modules.backup; import java.io.File; import java.time.LocalDateTime; +import java.time.format.DateTimeParseException; import java.util.Map.Entry; import java.util.Optional; import java.util.TreeMap; @@ -80,7 +81,13 @@ public abstract class BackupCleaner implements UnaryOperator, Ru static DateTimeFormatter dateFileNameFormatter = new DateTimeFormatterBuilder() - .append(DateTimeFormatter.BASIC_ISO_DATE) + .appendValue(ChronoField.YEAR, 4) + .appendValue(ChronoField.MONTH_OF_YEAR, 2) + .appendValue(ChronoField.DAY_OF_MONTH, 2) .appendLiteral('-') - .appendValue(ChronoField.HOUR_OF_DAY, 2) // there is no DateTimeFormatter.BASIC_ISO_TIME + .appendValue(ChronoField.HOUR_OF_DAY, 2) .appendValue(ChronoField.MINUTE_OF_HOUR, 2) .appendValue(ChronoField.SECOND_OF_MINUTE, 2) .toFormatter();