From bee9966450e458bc6cc622aa8975d148352b9dc0 Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Thu, 30 Aug 2018 17:52:50 +0300 Subject: [PATCH] Ignored exception in #715 --- .../formatting/TimeAmountFormatter.java | 34 +++++++++---------- .../system/tasks/LogsFolderCleanTask.java | 6 +++- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/formatting/TimeAmountFormatter.java b/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/formatting/TimeAmountFormatter.java index e758a55cf..51471b492 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/formatting/TimeAmountFormatter.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/formatting/TimeAmountFormatter.java @@ -57,20 +57,13 @@ public class TimeAmountFormatter implements Formatter { return formattedTime; } - private void appendSeconds(StringBuilder builder, long seconds, long minutes, long hours, String fHours, String fMinutes, String fSeconds) { - if (seconds != 0) { - String s = fSeconds.replace(SECONDS_PH, String.valueOf(seconds)); - if (minutes == 0 && s.contains(MINUTES_PH)) { - if (hours == 0 && fMinutes.contains(HOURS_PH)) { - builder.append(fHours.replace(ZERO_PH, "0").replace(HOURS_PH, "0")); - } - builder.append(fMinutes.replace(HOURS_PH, "").replace(ZERO_PH, "0").replace(MINUTES_PH, "0")); - } - s = s.replace(MINUTES_PH, ""); - if (s.contains(ZERO_PH) && String.valueOf(seconds).length() == 1) { + private void appendHours(StringBuilder builder, long hours, String fHours) { + if (hours != 0) { + String h = fHours.replace(HOURS_PH, String.valueOf(hours)); + if (h.contains(ZERO_PH) && String.valueOf(hours).length() == 1) { builder.append('0'); } - builder.append(s); + builder.append(h); } } @@ -89,13 +82,20 @@ public class TimeAmountFormatter implements Formatter { } } - private void appendHours(StringBuilder builder, long hours, String fHours) { - if (hours != 0) { - String h = fHours.replace(HOURS_PH, String.valueOf(hours)); - if (h.contains(ZERO_PH) && String.valueOf(hours).length() == 1) { + private void appendSeconds(StringBuilder builder, long seconds, long minutes, long hours, String fHours, String fMinutes, String fSeconds) { + if (seconds != 0) { + String s = fSeconds.replace(SECONDS_PH, String.valueOf(seconds)); + if (minutes == 0 && s.contains(MINUTES_PH)) { + if (hours == 0 && fMinutes.contains(HOURS_PH)) { + builder.append(fHours.replace(ZERO_PH, "0").replace(HOURS_PH, "0")); + } + builder.append(fMinutes.replace(HOURS_PH, "").replace(ZERO_PH, "0").replace(MINUTES_PH, "0")); + } + s = s.replace(MINUTES_PH, ""); + if (s.contains(ZERO_PH) && String.valueOf(seconds).length() == 1) { builder.append('0'); } - builder.append(h); + builder.append(s); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/tasks/LogsFolderCleanTask.java b/Plan/src/main/java/com/djrapitops/plan/system/tasks/LogsFolderCleanTask.java index 1bdd02b12..a8bf2bbf5 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/tasks/LogsFolderCleanTask.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/tasks/LogsFolderCleanTask.java @@ -34,7 +34,11 @@ public class LogsFolderCleanTask extends AbsRunnable { } catch (NullPointerException ignore) { /* Ignored - not supposed to occur. */ } finally { - cancel(); + try { + cancel(); + } catch (Exception ignore) { + /* Ignored, TaskCenter concurrent modification exception, will be fixed later in apf-3.3.0. */ + } } }