summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/backup/incremental
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/backup/incremental')
-rw-r--r--src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/IncBackupInfoSerializer.java4
-rw-r--r--src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/SavedIncBackupV1.java5
2 files changed, 4 insertions, 5 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/IncBackupInfoSerializer.java b/src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/IncBackupInfoSerializer.java
index 45590ba..d084aef 100644
--- a/src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/IncBackupInfoSerializer.java
+++ b/src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/IncBackupInfoSerializer.java
@@ -26,13 +26,13 @@ public class IncBackupInfoSerializer {
return (SavedIncrementalBackup) o;
} else if (o instanceof ObjectCollection) {
// backward compatibility with old-style (v0) incremental backup
- BackupFileNameEncoder.BackupBasicInformation info = new IncrementalBackupFileNameEncoder().decode(file.getName());
+ BackupFileNameEncoder.BackupBasicInformation info = IncrementalBackupFileNameEncoder.INSTANCE.decode(file.getName());
if (info == null)
throw new IOException("Invalid backup file name.");
return new SavedIncBackupV0(ObjectCollectionConverter.convert((ObjectCollection) o), info);
} else if (o instanceof ObjectCollection2) {
// compatible with 1.4.6 implementation
- BackupFileNameEncoder.BackupBasicInformation info = new IncrementalBackupFileNameEncoder().decode(file.getName());
+ BackupFileNameEncoder.BackupBasicInformation info = IncrementalBackupFileNameEncoder.INSTANCE.decode(file.getName());
if (info == null)
throw new IOException("Invalid backup file name.");
return new SavedIncBackupV0((ObjectCollection2) o, info);
diff --git a/src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/SavedIncBackupV1.java b/src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/SavedIncBackupV1.java
index 0ebe06a..bd2d4eb 100644
--- a/src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/SavedIncBackupV1.java
+++ b/src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/SavedIncBackupV1.java
@@ -2,10 +2,10 @@ package com.keuin.kbackupfabric.backup.incremental.serializer;
import com.keuin.kbackupfabric.backup.BackupFilesystemUtil;
import com.keuin.kbackupfabric.backup.incremental.ObjectCollection2;
+import com.keuin.kbackupfabric.util.DateUtil;
import java.io.Serializable;
import java.time.ZonedDateTime;
-import java.time.format.DateTimeFormatter;
import java.util.Objects;
public class SavedIncBackupV1 implements SavedIncrementalBackup, Serializable {
@@ -17,7 +17,6 @@ public class SavedIncBackupV1 implements SavedIncrementalBackup, Serializable {
private final long increasedSizeBytes;
private final int filesAdded;
private final int totalFiles;
- private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss");
public SavedIncBackupV1(ObjectCollection2 objectCollection2, String backupName, ZonedDateTime backupTime, long totalSizeBytes, long increasedSizeBytes, int filesAdded, int totalFiles) {
this.totalFiles = totalFiles;
@@ -90,7 +89,7 @@ public class SavedIncBackupV1 implements SavedIncrementalBackup, Serializable {
return String.format(
"%s, created at %s, files: %d (total size: %s), copied size: %s, files added: %d",
backupName,
- backupTime.format(formatter),
+ DateUtil.getString(backupTime),
totalFiles,
BackupFilesystemUtil.getFriendlyFileSizeString(totalSizeBytes),
BackupFilesystemUtil.getFriendlyFileSizeString(increasedSizeBytes),