ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martijn Kruithof ...@kruithof.xs4all.nl>
Subject Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Copy.java DependSet.java
Date Tue, 04 Jan 2005 21:16:52 GMT
Hi

Unless anyone objects within the next few days I will apply a patch that 
will make use of getFileUtils instead of newFileUtils
in all files in a uniform way (122 files impacted).

I have manually checked if it could do any harm when using the same 
instance of the FileUtils everywhere and could not find a single spot 
where it could do harm.

The Copy task leaks the fileutils instance it created to derived 
classes, so there might be subclasses of Copy that assume for some 
reason that Copy would create a new fileutils for every instance. I 
chose to ignore the fact that such misuse might be made by subclasses of 
Copy. I did take into account that the derived class of Copy might have 
provided an own/other implementation of FileUtils. (Though I would have 
liked to ignore this).

Kind Regards, Martijn

jkf@apache.org wrote:

>jkf         2005/01/04 12:20:52
>
>  Modified:    src/main/org/apache/tools/ant/util FileUtils.java
>               src/main/org/apache/tools/ant/types/selectors
>                        MappingSelector.java DateSelector.java
>               src/main/org/apache/tools/ant/taskdefs Copy.java
>                        DependSet.java
>  Log:
>  Made more consequent use of the method available in FileUtils to get the granularity.
>  
>  Revision  Changes    Path
>  1.80      +16 -4     ant/src/main/org/apache/tools/ant/util/FileUtils.java
>  
>  Index: FileUtils.java
>  ===================================================================
>  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/FileUtils.java,v
>  retrieving revision 1.79
>  retrieving revision 1.80
>  diff -u -r1.79 -r1.80
>  --- FileUtils.java	15 Dec 2004 12:10:43 -0000	1.79
>  +++ FileUtils.java	4 Jan 2005 20:20:49 -0000	1.80
>        *
>        * @return a new instance of FileUtils.
>  +     * @deprecated Use getFileUtils instead, FileUtils do not have state.
>        */
>       public static FileUtils newFileUtils() {
>           return new FileUtils();
>       }
>   
>       /**
>  +     * Method to retrieve The FileUtils, which is shared by all users of this
>  +     * method.
>  +     * @return an instance of FileUtils.
>  +     */
>  +    public static FileUtils getFileUtils() {
>  +        return PRIMARY_INSTANCE;
>  +    }
>  +
>  
>


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


Mime
View raw message