[tor-commits] [orbot/master] small fixes for service (NPE handling) and resource installer
n8fr8 at torproject.org
n8fr8 at torproject.org
Thu Apr 17 15:36:58 UTC 2014
commit eab54f7af9f4ebecf3192d33158462ef50392922
Author: Nathan Freitas <nathan at freitas.net>
Date: Wed Apr 16 16:22:09 2014 -0400
small fixes for service (NPE handling) and resource installer
---
src/org/torproject/android/service/TorResourceInstaller.java | 6 +++---
src/org/torproject/android/service/TorService.java | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/org/torproject/android/service/TorResourceInstaller.java b/src/org/torproject/android/service/TorResourceInstaller.java
index d17cd70..04b7d2d 100644
--- a/src/org/torproject/android/service/TorResourceInstaller.java
+++ b/src/org/torproject/android/service/TorResourceInstaller.java
@@ -150,7 +150,7 @@ public class TorResourceInstaller implements TorServiceConstants {
/*
* Write the inputstream contents to the file
*/
- private static boolean streamToFile(InputStream stm, File outFile, boolean append, boolean zip) throws IOException
+ public static boolean streamToFile(InputStream stm, File outFile, boolean append, boolean zip) throws IOException
{
byte[] buffer = new byte[FILE_WRITE_BUFFER_SIZE];
@@ -187,7 +187,7 @@ public class TorResourceInstaller implements TorServiceConstants {
}
//copy the file from inputstream to File output - alternative impl
- public void copyFile (InputStream is, File outputFile)
+ public static void copyFile (InputStream is, File outputFile)
{
try {
@@ -230,7 +230,7 @@ public class TorResourceInstaller implements TorServiceConstants {
* @throws IOException on error
* @throws InterruptedException when interrupted
*/
- private static void copyRawFile(Context ctx, int resid, File file, String mode, boolean isZipd) throws IOException, InterruptedException
+ public static void copyRawFile(Context ctx, int resid, File file, String mode, boolean isZipd) throws IOException, InterruptedException
{
final String abspath = file.getAbsolutePath();
// Write the iptables binary
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index ecc5017..7f889c0 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -199,8 +199,8 @@ public class TorService extends Service implements TorServiceConstants, TorConst
private void clearNotifications ()
{
- mNotificationManager.cancelAll();
-
+ if (mNotificationManager != null)
+ mNotificationManager.cancelAll();
}
More information about the tor-commits
mailing list