commit 42d8ca1377e64559b685a1dbbd3cf26bb5899618 Author: Nathan Freitas nathan@freitas.net Date: Fri May 2 14:58:47 2014 -0400
for some devices, the process-id is listed first --- src/org/torproject/android/service/TorServiceUtils.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/org/torproject/android/service/TorServiceUtils.java b/src/org/torproject/android/service/TorServiceUtils.java index be1694e..70c5746 100644 --- a/src/org/torproject/android/service/TorServiceUtils.java +++ b/src/org/torproject/android/service/TorServiceUtils.java @@ -89,9 +89,17 @@ public class TorServiceUtils implements TorServiceConstants { { if (line.contains(command)) { + String[] lineParts = line.split("\s+"); - procId = Integer.parseInt(lineParts[1]); + try { + + procId = Integer.parseInt(lineParts[1]); //for most devices it is the second number + } catch(NumberFormatException e) { + procId = Integer.parseInt(lineParts[0]); //but for samsungs it is the first + + } + break; }
tor-commits@lists.torproject.org