ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r349627 - /ant/core/trunk/src/main/org/apache/tools/ant/types/Resource.java
Date Tue, 29 Nov 2005 04:35:07 GMT
Author: bodewig
Date: Mon Nov 28 20:35:04 2005
New Revision: 349627

URL: http://svn.apache.org/viewcvs?rev=349627&view=rev
Log:
really say UNKNOWN if you don't know the size

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/types/Resource.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/Resource.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/types/Resource.java?rev=349627&r1=349626&r2=349627&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/Resource.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/Resource.java Mon Nov 28 20:35:04 2005
@@ -39,6 +39,9 @@
     /** 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 @@
             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 @@
         if (isReference()) {
             return ((Resource) getCheckedRef()).getSize();
         }
-        return isExists() && size != null ? size.longValue() : 0L;
+        return isExists() ?
+            (size != null ? size.longValue() : UNKNOWN_SIZE)
+            : 0L;
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message