You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by pe...@apache.org on 2007/10/05 11:30:14 UTC
svn commit: r582160 -
/ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java
Author: peterreilly
Date: Fri Oct 5 02:30:14 2007
New Revision: 582160
URL: http://svn.apache.org/viewvc?rev=582160&view=rev
Log:
fix for SelectorUtils.isOutOfDate for non-file resources
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java
Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java?rev=582160&r1=582159&r2=582160&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java Fri Oct 5 02:30:14 2007
@@ -24,6 +24,7 @@
import org.apache.tools.ant.types.Resource;
import org.apache.tools.ant.util.FileUtils;
+import org.apache.tools.ant.types.resources.FileResource;
/**
* <p>This is a utility class used by selectors and DirectoryScanner. The
@@ -616,10 +617,12 @@
public static boolean isOutOfDate(Resource src, Resource target,
long granularity) {
long sourceLastModified = src.getLastModified();
- if (sourceLastModified == 0L) {
- // Does not exist. Quicker than checking exists() again.
- return false;
- }
+ // Check if source exists - use sourceLastModified for file resources
+ // as it quicker that checking exists() again, however string reources
+ // have a last modified time of 0
+ boolean sourceExists = (src instanceof FileResource)
+ ? sourceLastModified != 0L : src.isExists();
+
long targetLastModified = target.getLastModified();
if (targetLastModified == 0L) {
return true;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: svn commit: r582160 - /ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java
Posted by Peter Reilly <pe...@gmail.com>.
On 10/5/07, Jesse Glick <je...@sun.com> wrote:
> peterreilly@apache.org wrote:
> > URL: http://svn.apache.org/viewvc?rev=582160&view=rev
> > + // Check if source exists - use sourceLastModified for file resources
> > + // as it quicker that checking exists() again, however string reources [sic]
> > + // have a last modified time of 0
>
> Resource.getLastModified Javadoc states that it returns 0 if the
> resource does not exist. Should this be clarified to state that it may
> return 0 for other reasons?
It should as it is incorrect!.
Peter
>
> -J.
>
> --
> jesse.glick@sun.com netbeans.org ant.apache.org hudson.dev.java.net
> http://google.com/search?q=e%5E%28pi*i%29%2B1
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: svn commit: r582160 - /ant/core/trunk/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java
Posted by Jesse Glick <je...@sun.com>.
peterreilly@apache.org wrote:
> URL: http://svn.apache.org/viewvc?rev=582160&view=rev
> + // Check if source exists - use sourceLastModified for file resources
> + // as it quicker that checking exists() again, however string reources [sic]
> + // have a last modified time of 0
Resource.getLastModified Javadoc states that it returns 0 if the
resource does not exist. Should this be clarified to state that it may
return 0 for other reasons?
-J.
--
jesse.glick@sun.com netbeans.org ant.apache.org hudson.dev.java.net
http://google.com/search?q=e%5E%28pi*i%29%2B1
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org