summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java17
-rw-r--r--main/src/main/java/de/blinkt/openvpn/fragments/Utils.java11
2 files changed, 15 insertions, 13 deletions
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 77bb26dc..a30cde5b 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java
@@ -136,12 +136,12 @@ class LogFileHandler extends Handler {
} else {
VpnStatus.logError(String.format(Locale.getDefault(),
"Could not read log item from file: %d/%d: %s",
- read, len, Utils.bytesToHex(buf, read)));
+ read, len, bytesToHex(buf, Math.max(read,80))));
}
p.recycle();
//Next item
- read = logFile.read(buf, 0, 2);
+ read = logFile.read(buf, 0, 4);
itemsRead++;
if (itemsRead > 2*VpnStatus.MAXLOGENTRIES) {
VpnStatus.logError("Too many logentries read from cache, aborting.");
@@ -161,4 +161,17 @@ class LogFileHandler extends Handler {
}
}
+ final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();
+ public static String bytesToHex(byte[] bytes, int len) {
+ len = Math.min(bytes.length, len);
+ char[] hexChars = new char[len * 2];
+ for ( int j = 0; j < len; j++ ) {
+ int v = bytes[j] & 0xFF;
+ hexChars[j * 2] = hexArray[v >>> 4];
+ hexChars[j * 2 + 1] = hexArray[v & 0x0F];
+ }
+ return new String(hexChars);
+ }
+
+
}
diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java b/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java
index 382a97f6..243eae98 100644
--- a/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java
+++ b/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java
@@ -263,15 +263,4 @@ public class Utils {
return prefix + VpnProfile.INLINE_TAG + newData;
}
- final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();
- public static String bytesToHex(byte[] bytes, int len) {
- len = Math.min(bytes.length, len);
- char[] hexChars = new char[len * 2];
- for ( int j = 0; j < len; j++ ) {
- int v = bytes[j] & 0xFF;
- hexChars[j * 2] = hexArray[v >>> 4];
- hexChars[j * 2 + 1] = hexArray[v & 0x0F];
- }
- return new String(hexChars);
- }
}