From 0d491c1dce964ee94a805c595fbf589dbbb2902e Mon Sep 17 00:00:00 2001 From: Kristian Monsen Date: Tue, 18 Oct 2011 16:24:05 +0100 Subject: WebView part of fix for bug 5307956 JniUtil now returns empty string instead of crashing when the OS can't find/create a cache directory. Have only seen this happen when the whole file system was broken. Change-Id: I867017d62dce83cae3e83959eac9e974433bbdc9 --- core/java/android/webkit/JniUtil.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/java/android/webkit/JniUtil.java b/core/java/android/webkit/JniUtil.java index 7759ff37053e..466204040a89 100644 --- a/core/java/android/webkit/JniUtil.java +++ b/core/java/android/webkit/JniUtil.java @@ -22,6 +22,7 @@ import android.net.Uri; import android.provider.Settings; import android.util.Log; +import java.io.File; import java.io.InputStream; class JniUtil { @@ -79,7 +80,12 @@ class JniUtil { checkInitialized(); if (sCacheDirectory == null) { - sCacheDirectory = sContext.getCacheDir().getAbsolutePath(); + File cacheDir = sContext.getCacheDir(); + if (cacheDir == null) { + sCacheDirectory = ""; + } else { + sCacheDirectory = cacheDir.getAbsolutePath(); + } } return sCacheDirectory; -- cgit v1.2.3-59-g8ed1b