commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r982437 - /commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
Date Thu, 05 Aug 2010 00:18:19 GMT
Author: niallp
Date: Thu Aug  5 00:18:19 2010
New Revision: 982437

URL: http://svn.apache.org/viewvc?rev=982437&view=rev
Log:
IO-240 ensure cvsFilter and svnFilter are only created once.

Modified:
    commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java?rev=982437&r1=982436&r2=982437&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
(original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/FileFilterUtils.java
Thu Aug  5 00:18:19 2010
@@ -380,10 +380,12 @@ public class FileFilterUtils {
 
     //-----------------------------------------------------------------------
     /* Constructed on demand and then cached */
-    private static IOFileFilter cvsFilter;
+    private static final IOFileFilter cvsFilter = notFileFilter(
+            andFileFilter(directoryFileFilter(), nameFileFilter("CVS")));;
 
     /* Constructed on demand and then cached */
-    private static IOFileFilter svnFilter;
+    private static final IOFileFilter svnFilter = svnFilter = notFileFilter(
+            andFileFilter(directoryFileFilter(), nameFileFilter(".svn")));
 
     /**
      * Decorates a filter to make it ignore CVS directories.
@@ -395,10 +397,6 @@ public class FileFilterUtils {
      * @since Commons IO 1.1 (method existed but had bug in 1.0)
      */
     public static IOFileFilter makeCVSAware(IOFileFilter filter) {
-        if (cvsFilter == null) {
-            cvsFilter = notFileFilter(
-                andFileFilter(directoryFileFilter(), nameFileFilter("CVS")));
-        }
         if (filter == null) {
             return cvsFilter;
         } else {
@@ -416,10 +414,6 @@ public class FileFilterUtils {
      * @since Commons IO 1.1
      */
     public static IOFileFilter makeSVNAware(IOFileFilter filter) {
-        if (svnFilter == null) {
-            svnFilter = notFileFilter(
-                andFileFilter(directoryFileFilter(), nameFileFilter(".svn")));
-        }
         if (filter == null) {
             return svnFilter;
         } else {



Mime
View raw message