From 84f5af0d99dc208468e29c2c423591b75a060795 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Tue, 18 Dec 2012 11:25:45 +0100 Subject: Fix the Illegal Thread State bug --- src/de/blinkt/openvpn/ConfigConverter.java | 2 +- src/de/blinkt/openvpn/OpenVPNThread.java | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/de/blinkt/openvpn/ConfigConverter.java b/src/de/blinkt/openvpn/ConfigConverter.java index 8d746409..393384b8 100644 --- a/src/de/blinkt/openvpn/ConfigConverter.java +++ b/src/de/blinkt/openvpn/ConfigConverter.java @@ -228,7 +228,7 @@ public class ConfigConverter extends ListActivity { File possibleFile = findFile(filename); if(possibleFile==null) - return null; + return filename; else return readFileContent(possibleFile,base64encode); diff --git a/src/de/blinkt/openvpn/OpenVPNThread.java b/src/de/blinkt/openvpn/OpenVPNThread.java index b4ead269..13b8688b 100644 --- a/src/de/blinkt/openvpn/OpenVPNThread.java +++ b/src/de/blinkt/openvpn/OpenVPNThread.java @@ -39,9 +39,11 @@ public class OpenVPNThread implements Runnable { } finally { int exitvalue = 0; try { - exitvalue = mProcess.exitValue(); + exitvalue = mProcess.waitFor(); } catch ( IllegalThreadStateException ite) { OpenVPN.logError("Illegal Thread state: " + ite.getLocalizedMessage()); + } catch (InterruptedException ie) { + OpenVPN.logError("InterruptedException: " + ie.getLocalizedMessage()); } if( exitvalue != 0) OpenVPN.logError("Process exited with exit value " + exitvalue); @@ -84,12 +86,12 @@ public class OpenVPNThread implements Runnable { mProcess.getOutputStream().close(); InputStream in = mProcess.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(in)); - - + while(true) { String logline = br.readLine(); - if(logline==null) + if(logline==null) { return; + } OpenVPN.logMessage(0, "P:", logline); } -- cgit v1.2.3