bug 707929 - java.lang.NullPointerException @ ZipFile.getInputStream(ZipFile.java:256) r=mfinke a=java-only
authorBrad Lassey <blassey@mozilla.com>
Tue, 13 Dec 2011 17:54:28 -0500
changeset 84170 1f03a95b661ae74e668ed107670f0f1a72b1d60a
parent 84169 923dab6343f90c62668aa781466095629d090982
child 84171 58a2785556801c69aa7041f470f8b284cfcf1074
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinke, java-only
bugs707929
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 707929 - java.lang.NullPointerException @ ZipFile.getInputStream(ZipFile.java:256) r=mfinke a=java-only
mobile/android/base/AboutHomeContent.java
--- a/mobile/android/base/AboutHomeContent.java
+++ b/mobile/android/base/AboutHomeContent.java
@@ -231,26 +231,32 @@ public class AboutHomeContent extends Sc
     }
 
     InputStream getRecommendedAddonsStream(Activity activity) throws Exception{
         InputStream is = getProfileRecommendedAddonsStream();
         if (is != null)
             return is;
         File applicationPackage = new File(activity.getApplication().getPackageResourcePath());
         ZipFile zip = new ZipFile(applicationPackage);
+        if (zip == null)
+            return null;
         ZipEntry fileEntry = zip.getEntry("recommended-addons.json");
+        if (fileEntry == null)
+            return null;
         return zip.getInputStream(fileEntry);
     }
 
     void readRecommendedAddons(final Activity activity) {
         GeckoAppShell.getHandler().post(new Runnable() {
             public void run() {
                 try {
                     byte[] buf = new byte[32768];
                     InputStream fileStream = getRecommendedAddonsStream(activity);
+                    if (fileStream == null)
+                        return;
                     StringBuffer jsonString = new StringBuffer();
                     int read = 0;
                     while ((read = fileStream.read(buf, 0, 32768)) != -1) {
                         jsonString.append(new String(buf, 0, read));
                     }
                     final JSONArray array = new JSONObject(jsonString.toString()).getJSONArray("addons");
                     GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
                         public void run() {