From 3e8489868d2694b8d17b606842d3b735dc3d7acd Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 26 Dec 2013 23:10:16 -0800 Subject: Only do date check if hoursOld is specified --- src/github/daneren2005/dsub/util/FileUtil.java | 12 +++++++----- 1 file 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"); -- cgit v1.2.3