From eab54f7af9f4ebecf3192d33158462ef50392922 Mon Sep 17 00:00:00 2001 From: Nathan Freitas Date: Wed, 16 Apr 2014 16:22:09 -0400 Subject: [PATCH] small fixes for service (NPE handling) and resource installer --- .../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 d17cd703..04b7d2d7 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 ecc50170..7f889c01 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(); }