From a6792f3fc5e96c67581bfaace617ee63c6cb1c5b Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Tue, 29 Nov 2005 04:35:04 +0000 Subject: [PATCH] really say UNKNOWN if you don't know the size git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@349627 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/types/Resource.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/org/apache/tools/ant/types/Resource.java b/src/main/org/apache/tools/ant/types/Resource.java index eccbdc22c..4166ad3bd 100644 --- a/src/main/org/apache/tools/ant/types/Resource.java +++ b/src/main/org/apache/tools/ant/types/Resource.java @@ -39,6 +39,9 @@ public class Resource extends DataType /** Constant unknown size */ public static final long UNKNOWN_SIZE = -1; + /** Constant unknown datetime for getLastModified */ + public static final long UNKNOWN_DATETIME = 0L; + /** Magic number */ protected static final int MAGIC = getMagicNumber("Resource".getBytes()); @@ -181,10 +184,10 @@ public class Resource extends DataType return ((Resource) getCheckedRef()).getLastModified(); } if (!isExists() || lastmodified == null) { - return 0L; + return UNKNOWN_DATETIME; } long result = lastmodified.longValue(); - return result < 0L ? 0L : result; + return result < UNKNOWN_DATETIME ? UNKNOWN_DATETIME : result; } /** @@ -237,7 +240,9 @@ public class Resource extends DataType if (isReference()) { return ((Resource) getCheckedRef()).getSize(); } - return isExists() && size != null ? size.longValue() : 0L; + return isExists() ? + (size != null ? size.longValue() : UNKNOWN_SIZE) + : 0L; } /**