summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);