From 8b65ef6b34295c15dfc0ce000ab18fa9aaa92e63 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 11 Jan 2023 10:44:14 +0100 Subject: [PATCH] Debug: classifier file size --- app/src/main/java/eu/faircode/email/Log.java | 4 ++++ app/src/main/java/eu/faircode/email/MessageClassifier.java | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Log.java b/app/src/main/java/eu/faircode/email/Log.java index d17300cb8e..fbc5efc1d2 100644 --- a/app/src/main/java/eu/faircode/email/Log.java +++ b/app/src/main/java/eu/faircode/email/Log.java @@ -2048,6 +2048,10 @@ public class Log { .append(TextHelper.canTransliterate()) .append("\r\n"); + sb.append("Classifier: ") + .append(Helper.humanReadableByteCount(MessageClassifier.getSize(context))) + .append("\r\n"); + sb.append("\r\n"); int cpus = Runtime.getRuntime().availableProcessors(); diff --git a/app/src/main/java/eu/faircode/email/MessageClassifier.java b/app/src/main/java/eu/faircode/email/MessageClassifier.java index 305b8ba203..a9959cd5bf 100644 --- a/app/src/main/java/eu/faircode/email/MessageClassifier.java +++ b/app/src/main/java/eu/faircode/email/MessageClassifier.java @@ -759,8 +759,11 @@ public class MessageClassifier { } static long getSize(Context context) { - File file = getFile(context, false); - return (file.exists() ? file.length() : -1L); + try { + return getFile(context, false).length(); + } catch (Throwable ignored) { + return -1L; + } } private static class State {