From 89b6473abbd3fad859e8a2e0ca1733a6cd8d5805 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Wed, 9 Mar 2016 13:15:50 +0100 Subject: Bug not yet understand but try to the best to avoid it being triggered --- main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java | 8 +++++++- main/src/main/res/values/strings.xml | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'main') diff --git a/main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java b/main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java index da9cb6ef..9f63785c 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java +++ b/main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java @@ -20,6 +20,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.util.Locale; +import de.blinkt.openvpn.R; import de.blinkt.openvpn.fragments.Utils; /** @@ -45,6 +46,8 @@ class LogFileHandler extends Handler { public void handleMessage(Message msg) { try { if (msg.what == LOG_INIT) { + if (mLogFile != null) + throw new RuntimeException("mLogFile not null"); readLogCache((File) msg.obj); openLogFile((File) msg.obj); } else if (msg.what == LOG_MESSAGE && msg.obj instanceof VpnStatus.LogItem) { @@ -109,7 +112,6 @@ class LogFileHandler extends Handler { if (!logfile.exists() || !logfile.canRead()) return; - VpnStatus.logDebug("Reread log items from cache file"); try { @@ -146,7 +148,11 @@ class LogFileHandler extends Handler { VpnStatus.logError("Too many logentries read from cache, aborting."); read = 0; } + } + VpnStatus.logDebug(R.string.reread_log, itemsRead); + + } catch (java.io.IOException | java.lang.RuntimeException e) { VpnStatus.logError("Reading cached logfile failed"); diff --git a/main/src/main/res/values/strings.xml b/main/src/main/res/values/strings.xml index ec3449eb..85bf1128 100755 --- a/main/src/main/res/values/strings.xml +++ b/main/src/main/res/values/strings.xml @@ -404,4 +404,5 @@ Missing user certificate or user certifcate key file Missing CA certificate Certifcate Revoke List (optional) + Reread (%d) log items from log cache file -- cgit v1.2.3