summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFicus Kirkpatrick <ficus@android.com>2014-06-25 00:28:50 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-06-25 00:28:50 +0000
commitb3b7e68078c4579f11c1c559f027f4edde70bdc9 (patch)
tree7b2b18dacacfdc884346e4c763a871a5fdfcf348
parenteafdc0ceab8589c108fe60add8c0377e4481d863 (diff)
parent6ccd708adf345337137a7ef8efa6fd618afa7bc4 (diff)
downloadandroid_frameworks_volley-stable/cm-12.0-YNG3C.tar.gz
android_frameworks_volley-stable/cm-12.0-YNG3C.tar.bz2
android_frameworks_volley-stable/cm-12.0-YNG3C.zip
* commit '6ccd708adf345337137a7ef8efa6fd618afa7bc4': Fix crash/OOM in DiskBasedCache
-rw-r--r--src/com/android/volley/toolbox/DiskBasedCache.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/com/android/volley/toolbox/DiskBasedCache.java b/src/com/android/volley/toolbox/DiskBasedCache.java
index 2a4761b..d397aad 100644
--- a/src/com/android/volley/toolbox/DiskBasedCache.java
+++ b/src/com/android/volley/toolbox/DiskBasedCache.java
@@ -61,7 +61,7 @@ public class DiskBasedCache implements Cache {
private static final float HYSTERESIS_FACTOR = 0.9f;
/** Magic number for current version of cache file format. */
- private static final int CACHE_MAGIC = 0x20120504;
+ private static final int CACHE_MAGIC = 0x20140623;
/**
* Constructs an instance of the DiskBasedCache at the specified directory.
@@ -197,7 +197,12 @@ public class DiskBasedCache implements Cache {
try {
FileOutputStream fos = new FileOutputStream(file);
CacheHeader e = new CacheHeader(key, entry);
- e.writeHeader(fos);
+ boolean success = e.writeHeader(fos);
+ if (!success) {
+ fos.close();
+ VolleyLog.d("Failed to write header for %s", file.getAbsolutePath());
+ throw new IOException();
+ }
fos.write(entry.data);
fos.close();
putEntry(key, e);