From 5063ab12c48a6612d903c44c943230b6c323f602 Mon Sep 17 00:00:00 2001 From: Keuin Date: Sun, 24 Jan 2021 20:01:17 +0800 Subject: Code refactor: eliminate unnecessary instance creation of IncrementalBackupFileNameEncoder --- .../backup/incremental/serializer/SavedIncBackupV1.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/main/java/com/keuin/kbackupfabric/backup/incremental/serializer/SavedIncBackupV1.java') 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), -- cgit v1.2.3