diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-12-26 23:10:16 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-12-26 23:10:16 -0800 |
commit | 3e8489868d2694b8d17b606842d3b735dc3d7acd (patch) | |
tree | 0148beb762d588016d926e0ccdfb33c3b7c84832 /src | |
parent | 39a709231b33482cc418d670ec425b633bacd4b6 (diff) | |
download | dsub-3e8489868d2694b8d17b606842d3b735dc3d7acd.tar.gz dsub-3e8489868d2694b8d17b606842d3b735dc3d7acd.tar.bz2 dsub-3e8489868d2694b8d17b606842d3b735dc3d7acd.zip |
Only do date check if hoursOld is specified
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/util/FileUtil.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/github/daneren2005/dsub/util/FileUtil.java b/src/github/daneren2005/dsub/util/FileUtil.java index f72ae66b..87ec571b 100644 --- a/src/github/daneren2005/dsub/util/FileUtil.java +++ b/src/github/daneren2005/dsub/util/FileUtil.java @@ -430,11 +430,13 @@ public class FileUtil { try { File file = new File(context.getCacheDir(), fileName); - Date fileDate = new Date(file.lastModified()); - // Convert into hours - long age = (new Date().getTime() - fileDate.getTime()) / 1000 / 3600; - if(hoursOld != 0 && age > hoursOld) { - return null; + if(hoursOld != 0) { + Date fileDate = new Date(file.lastModified()); + // Convert into hours + long age = (new Date().getTime() - fileDate.getTime()) / 1000 / 3600; + if(age > hoursOld) { + return null; + } } RandomAccessFile randomFile = new RandomAccessFile(file, "r"); |