summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-12-18 11:25:45 +0100
committerArne Schwabe <arne@rfc2549.org>2012-12-18 11:25:45 +0100
commite300225f32eb40961aee52aaaedb9bb6a7a249f4 (patch)
tree8cf13825a44678888b447d9aebf47846de0fb717
parenta01e771f678fbcfff3b7a38f42ce392102165fcc (diff)
Fix the Illegal Thread State bug
-rw-r--r--src/de/blinkt/openvpn/ConfigConverter.java2
-rw-r--r--src/de/blinkt/openvpn/OpenVPNThread.java10
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);
}