diff options
author | Ficus Kirkpatrick <ficus@android.com> | 2014-06-25 00:28:50 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-06-25 00:28:50 +0000 |
commit | b3b7e68078c4579f11c1c559f027f4edde70bdc9 (patch) | |
tree | 7b2b18dacacfdc884346e4c763a871a5fdfcf348 | |
parent | eafdc0ceab8589c108fe60add8c0377e4481d863 (diff) | |
parent | 6ccd708adf345337137a7ef8efa6fd618afa7bc4 (diff) | |
download | android_frameworks_volley-stable/cm-12.0-YNG4N.tar.gz android_frameworks_volley-stable/cm-12.0-YNG4N.tar.bz2 android_frameworks_volley-stable/cm-12.0-YNG4N.zip |
am 6ccd708a: am 0e406003: Merge "Fix crash/OOM in DiskBasedCache"staging/cm-12.1staging/cm-12.0-cafstable/cm-12.1-YOG7Dstable/cm-12.1-YOG4Pstable/cm-12.1-YOG3Cstable/cm-12.0-YNG4Nstable/cm-12.0-YNG3Cstable/cm-12.0-YNG1TAstable/cm-12.0-YNG1Tstable/cm-12.0-YNG1Icm-12.1cm-12.0
* commit '6ccd708adf345337137a7ef8efa6fd618afa7bc4':
Fix crash/OOM in DiskBasedCache
-rw-r--r-- | src/com/android/volley/toolbox/DiskBasedCache.java | 9 |
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); |