diff options
author | Ralph Bergmann <ralph@the4thfloor.eu> | 2015-03-06 20:18:58 +0100 |
---|---|---|
committer | Ralph Bergmann <ralph@the4thfloor.eu> | 2015-03-06 20:18:58 +0100 |
commit | f42d384cece1686c75c282e5cb72fa9b340af5fe (patch) | |
tree | fc18f03943e0ac3c90d2cf44070ebb0f65334447 /src/main/java | |
parent | 79d00f42dd34d409cd3b2deb0a82e99a0417e340 (diff) | |
download | volley-f42d384cece1686c75c282e5cb72fa9b340af5fe.tar.gz |
Fix broken DiskBasedCache
Change-Id: Ia5db47122af11223b55845ef8423424a9cddbb21
Signed-off-by: Ralph Bergmann <ralph@the4thfloor.eu>
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/android/volley/toolbox/DiskBasedCache.java | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/main/java/com/android/volley/toolbox/DiskBasedCache.java b/src/main/java/com/android/volley/toolbox/DiskBasedCache.java index 036b55a..ff687d6 100644 --- a/src/main/java/com/android/volley/toolbox/DiskBasedCache.java +++ b/src/main/java/com/android/volley/toolbox/DiskBasedCache.java @@ -62,7 +62,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 = 0x20140623; + private static final int CACHE_MAGIC = 0x20150306; /** * Constructs an instance of the DiskBasedCache at the specified directory. @@ -397,16 +397,11 @@ public class DiskBasedCache implements Cache { entry.etag = null; } entry.serverDate = readLong(is); + entry.lastModified = readLong(is); entry.ttl = readLong(is); entry.softTtl = readLong(is); entry.responseHeaders = readStringStringMap(is); - try { - entry.lastModified = readLong(is); - } catch (EOFException e) { - // the old cache entry format doesn't know lastModified - } - return entry; } @@ -435,10 +430,10 @@ public class DiskBasedCache implements Cache { writeString(os, key); writeString(os, etag == null ? "" : etag); writeLong(os, serverDate); + writeLong(os, lastModified); writeLong(os, ttl); writeLong(os, softTtl); writeStringStringMap(responseHeaders, os); - writeLong(os, lastModified); os.flush(); return true; } catch (IOException e) { |