- File file = getCached(url);
- if (file.exists() && file.isFile()) {
- if (allowTooOld || !isOld(file, stable)) {
+ return check(getCached(url), allowTooOld, stable);
+ }
+
+ /**
+ * Check the resource to see if it is in the cache.
+ *
+ * @param cached
+ * the resource to check
+ * @param allowTooOld
+ * allow files even if they are considered too old
+ * @param stable
+ * a stable file (that dones't change too often) -- parameter
+ * used to check if the file is too old to keep or not
+ *
+ * @return TRUE if it is
+ *
+ */
+ private boolean check(File cached, boolean allowTooOld, boolean stable) {
+ if (cached.exists() && cached.isFile()) {
+ if (!allowTooOld && isOld(cached, stable)) {
+ if (!cached.delete()) {
+ tracer.error("Cannot delete temporary file: "
+ + cached.getAbsolutePath());
+ }
+ } else {