You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/11/27 14:31:27 UTC

[commons-vfs] branch master updated (f7916a9 -> 84fa6f7)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git.


    from f7916a9  Fix Checkstyle: Redundant 'final' modifier.
     new 5f8f7fe  MissingJavadocMethod: Missing a Javadoc comment.
     new 20cf3ae  Add FalseFileFilter.INSTANCE and deprecate FalseFileFilter.FALSE.
     new 5d6c451  Refactor common test fixtures.
     new 84fa6f7  Add TrueFileFilter.INSTANCE and deprecate TrueFileFilter.TRUE.

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/commons/vfs2/FileFilterSelector.java    |  7 ++++
 .../commons/vfs2/auth/StaticUserAuthenticator.java |  9 +++-
 .../commons/vfs2/filter/FalseFileFilter.java       | 11 ++++-
 .../apache/commons/vfs2/filter/TrueFileFilter.java | 12 +++++-
 .../commons/vfs2/filter/AndFileFilterTest.java     | 48 ++++++----------------
 .../commons/vfs2/filter/NotFileFilterTest.java     |  4 ++
 .../commons/vfs2/filter/OrFileFilterTest.java      | 36 +++-------------
 .../commons/vfs2/filter/TestFalseFileFilter.java   | 16 ++++++++
 .../commons/vfs2/filter/TestTrueFileFilter.java    | 16 ++++++++
 src/changes/changes.xml                            |  6 +++
 10 files changed, 96 insertions(+), 69 deletions(-)
 create mode 100644 commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/TestFalseFileFilter.java
 create mode 100644 commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/TestTrueFileFilter.java

[commons-vfs] 02/04: Add FalseFileFilter.INSTANCE and deprecate FalseFileFilter.FALSE.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git

commit 20cf3aeb72bcbb5250ce4943e85981d52f1bbcb6
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 27 09:28:43 2021 -0500

    Add FalseFileFilter.INSTANCE and deprecate FalseFileFilter.FALSE.
---
 .../java/org/apache/commons/vfs2/filter/FalseFileFilter.java  | 11 ++++++++++-
 .../org/apache/commons/vfs2/filter/NotFileFilterTest.java     |  1 +
 src/changes/changes.xml                                       |  3 +++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/FalseFileFilter.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/FalseFileFilter.java
index 73e5440..c251af5 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/FalseFileFilter.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/FalseFileFilter.java
@@ -34,8 +34,17 @@ public class FalseFileFilter implements FileFilter, Serializable {
 
     /**
      * Singleton instance of false filter.
+     *
+     * @since 2.10.0
+     */
+    public static final FileFilter INSTANCE = new FalseFileFilter();
+
+    /**
+     * Singleton instance of false filter.
+     * @deprecated Use {@link #INSTANCE}.
      */
-    public static final FileFilter FALSE = new FalseFileFilter();
+    @Deprecated
+    public static final FileFilter FALSE = INSTANCE;
 
     /**
      * Restrictive constructor.
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/NotFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/NotFileFilterTest.java
index 798758e..89f658b 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/NotFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/NotFileFilterTest.java
@@ -35,6 +35,7 @@ public class NotFileFilterTest extends BaseFilterTest {
         final FileSelectInfo any = createFileSelectInfo(new File("test1.txt"));
 
         Assert.assertFalse(new NotFileFilter(TrueFileFilter.TRUE).accept(any));
+        Assert.assertTrue(new NotFileFilter(FalseFileFilter.INSTANCE).accept(any));
         Assert.assertTrue(new NotFileFilter(FalseFileFilter.FALSE).accept(any));
 
     }
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 78f0a21..25b87c0 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -81,6 +81,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="add" dev="ggregory" due-to="Gary Gregory">
         DefaultFileMonitor implements AutoCloseable.
       </action>
+      <action type="add" dev="ggregory" due-to="Gary Gregory">
+        Add FalseFileFilter.INSTANCE and deprecate FalseFileFilter.FALSE.
+      </action>
       <!-- UDPATE -->
       <action type="update" dev="ggregory" due-to="Dependabot">
         Bump jakarta.mail from 1.6.7 to 2.0.1 #200.

[commons-vfs] 01/04: MissingJavadocMethod: Missing a Javadoc comment.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git

commit 5f8f7fe72b7c1c32236313c40e13553544ccad32
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 27 09:22:03 2021 -0500

    MissingJavadocMethod: Missing a Javadoc comment.
---
 .../main/java/org/apache/commons/vfs2/FileFilterSelector.java    | 7 +++++++
 .../org/apache/commons/vfs2/auth/StaticUserAuthenticator.java    | 9 ++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileFilterSelector.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileFilterSelector.java
index b5db30a..c0946ab 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileFilterSelector.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileFilterSelector.java
@@ -31,10 +31,17 @@ public class FileFilterSelector extends FileDepthSelector {
      */
     private final FileFilter fileFilter;
 
+    /**
+     * Constructs a new instance without a FileFilter.
+     */
     public FileFilterSelector() {
         this(null);
     }
 
+    /**
+     * Constructs a new instance with a FileFilter.
+     * @param fileFilter the FileFilter.
+     */
     public FileFilterSelector(final FileFilter fileFilter) {
         super(1, 1);
         this.fileFilter = fileFilter;
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java
index beb5acb..ce107c8 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java
@@ -37,9 +37,16 @@ public class StaticUserAuthenticator implements UserAuthenticator, Comparable<St
     /** The password */
     private final String password;
 
-    /** The user's domain */
+    /** The user domain */
     private final String domain;
 
+    /**
+     * Constructs a new instance.
+     *
+     * @param domain The user domain.
+     * @param username The user name.
+     * @param password The user password.
+     */
     public StaticUserAuthenticator(final String domain, final String username, final String password) {
         this.username = username;
         this.password = password;

[commons-vfs] 03/04: Refactor common test fixtures.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git

commit 5d6c451956eb07e2f584912d99c8ecedf794ec71
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 27 09:29:03 2021 -0500

    Refactor common test fixtures.
---
 .../commons/vfs2/filter/AndFileFilterTest.java     | 48 ++++++----------------
 .../commons/vfs2/filter/OrFileFilterTest.java      | 36 +++-------------
 .../commons/vfs2/filter/TestFalseFileFilter.java   | 16 ++++++++
 .../commons/vfs2/filter/TestTrueFileFilter.java    | 16 ++++++++
 4 files changed, 50 insertions(+), 66 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/AndFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/AndFileFilterTest.java
index f3da510..2fa68d4 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/AndFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/AndFileFilterTest.java
@@ -41,30 +41,6 @@ public class AndFileFilterTest extends BaseFilterTest {
 
     }
 
-    /**
-     * Always FALSE.
-     */
-    private static class False implements FileFilter {
-
-        @Override
-        public boolean accept(final FileSelectInfo fileSelectInfo) {
-            return false;
-        }
-
-    }
-
-    /**
-     * Always TRUE.
-     */
-    private static class True implements FileFilter {
-
-        @Override
-        public boolean accept(final FileSelectInfo fileSelectInfo) {
-            return true;
-        }
-
-    }
-
     @SuppressWarnings("deprecation")
     @Test
     public void testAccept() throws FileSystemException {
@@ -75,14 +51,14 @@ public class AndFileFilterTest extends BaseFilterTest {
         Assert.assertFalse(new AndFileFilter().accept(any));
 
         // True
-        Assert.assertTrue(new AndFileFilter(new True()).accept(any));
-        Assert.assertTrue(new AndFileFilter(new True(), new True()).accept(any));
+        Assert.assertTrue(new AndFileFilter(new TestTrueFileFilter()).accept(any));
+        Assert.assertTrue(new AndFileFilter(new TestTrueFileFilter(), new TestTrueFileFilter()).accept(any));
 
         // False
-        Assert.assertFalse(new AndFileFilter(new False()).accept(any));
-        Assert.assertFalse(new AndFileFilter(new False(), new False()).accept(any));
-        Assert.assertFalse(new AndFileFilter(new False(), new True()).accept(any));
-        Assert.assertFalse(new AndFileFilter(new True(), new False()).accept(any));
+        Assert.assertFalse(new AndFileFilter(new TestFalseFileFilter()).accept(any));
+        Assert.assertFalse(new AndFileFilter(new TestFalseFileFilter(), new TestFalseFileFilter()).accept(any));
+        Assert.assertFalse(new AndFileFilter(new TestFalseFileFilter(), new TestTrueFileFilter()).accept(any));
+        Assert.assertFalse(new AndFileFilter(new TestTrueFileFilter(), new TestFalseFileFilter()).accept(any));
 
     }
 
@@ -95,14 +71,14 @@ public class AndFileFilterTest extends BaseFilterTest {
         Assert.assertFalse(new AndFileFilter().accept(any));
 
         // True
-        Assert.assertTrue(new AndFileFilter(new True()).accept(any));
-        Assert.assertTrue(new AndFileFilter(new True(), new True()).accept(any));
+        Assert.assertTrue(new AndFileFilter(new TestTrueFileFilter()).accept(any));
+        Assert.assertTrue(new AndFileFilter(new TestTrueFileFilter(), new TestTrueFileFilter()).accept(any));
 
         // False
-        Assert.assertFalse(new AndFileFilter(new False()).accept(any));
-        Assert.assertFalse(new AndFileFilter(new False(), new False()).accept(any));
-        Assert.assertFalse(new AndFileFilter(new False(), new True()).accept(any));
-        Assert.assertFalse(new AndFileFilter(new True(), new False()).accept(any));
+        Assert.assertFalse(new AndFileFilter(new TestFalseFileFilter()).accept(any));
+        Assert.assertFalse(new AndFileFilter(new TestFalseFileFilter(), new TestFalseFileFilter()).accept(any));
+        Assert.assertFalse(new AndFileFilter(new TestFalseFileFilter(), new TestTrueFileFilter()).accept(any));
+        Assert.assertFalse(new AndFileFilter(new TestTrueFileFilter(), new TestFalseFileFilter()).accept(any));
 
     }
 
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/OrFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/OrFileFilterTest.java
index 50b7925..0f65381 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/OrFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/OrFileFilterTest.java
@@ -41,30 +41,6 @@ public class OrFileFilterTest extends BaseFilterTest {
 
     }
 
-    /**
-     * Always FALSE.
-     */
-    private static class False implements FileFilter {
-
-        @Override
-        public boolean accept(final FileSelectInfo fileInfo) {
-            return false;
-        }
-
-    }
-
-    /**
-     * Always TRUE.
-     */
-    private static class True implements FileFilter {
-
-        @Override
-        public boolean accept(final FileSelectInfo fileInfo) {
-            return true;
-        }
-
-    }
-
     @Test
     public void testAccept() throws FileSystemException {
 
@@ -74,14 +50,14 @@ public class OrFileFilterTest extends BaseFilterTest {
         Assert.assertFalse(new OrFileFilter().accept(any));
 
         // True
-        Assert.assertTrue(new OrFileFilter(new True()).accept(any));
-        Assert.assertTrue(new OrFileFilter(new True(), new True()).accept(any));
-        Assert.assertTrue(new OrFileFilter(new False(), new True()).accept(any));
-        Assert.assertTrue(new OrFileFilter(new True(), new False()).accept(any));
+        Assert.assertTrue(new OrFileFilter(new TestTrueFileFilter()).accept(any));
+        Assert.assertTrue(new OrFileFilter(new TestTrueFileFilter(), new TestTrueFileFilter()).accept(any));
+        Assert.assertTrue(new OrFileFilter(new TestFalseFileFilter(), new TestTrueFileFilter()).accept(any));
+        Assert.assertTrue(new OrFileFilter(new TestTrueFileFilter(), new TestFalseFileFilter()).accept(any));
 
         // False
-        Assert.assertFalse(new OrFileFilter(new False()).accept(any));
-        Assert.assertFalse(new OrFileFilter(new False(), new False()).accept(any));
+        Assert.assertFalse(new OrFileFilter(new TestFalseFileFilter()).accept(any));
+        Assert.assertFalse(new OrFileFilter(new TestFalseFileFilter(), new TestFalseFileFilter()).accept(any));
 
     }
 
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/TestFalseFileFilter.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/TestFalseFileFilter.java
new file mode 100644
index 0000000..b2f92bf
--- /dev/null
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/TestFalseFileFilter.java
@@ -0,0 +1,16 @@
+package org.apache.commons.vfs2.filter;
+
+import org.apache.commons.vfs2.FileFilter;
+import org.apache.commons.vfs2.FileSelectInfo;
+
+/**
+ * Always FALSE.
+ */
+class TestFalseFileFilter implements FileFilter {
+
+    @Override
+    public boolean accept(final FileSelectInfo fileSelectInfo) {
+        return false;
+    }
+
+}
\ No newline at end of file
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/TestTrueFileFilter.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/TestTrueFileFilter.java
new file mode 100644
index 0000000..08d995a
--- /dev/null
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/TestTrueFileFilter.java
@@ -0,0 +1,16 @@
+package org.apache.commons.vfs2.filter;
+
+import org.apache.commons.vfs2.FileFilter;
+import org.apache.commons.vfs2.FileSelectInfo;
+
+/**
+ * Always TRUE.
+ */
+class TestTrueFileFilter implements FileFilter {
+
+    @Override
+    public boolean accept(final FileSelectInfo fileSelectInfo) {
+        return true;
+    }
+
+}
\ No newline at end of file

[commons-vfs] 04/04: Add TrueFileFilter.INSTANCE and deprecate TrueFileFilter.TRUE.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git

commit 84fa6f7a02c57977d83125e8e5f24f24f3f4d790
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 27 09:31:24 2021 -0500

    Add TrueFileFilter.INSTANCE and deprecate TrueFileFilter.TRUE.
---
 .../java/org/apache/commons/vfs2/filter/TrueFileFilter.java  | 12 +++++++++++-
 .../org/apache/commons/vfs2/filter/NotFileFilterTest.java    |  3 +++
 src/changes/changes.xml                                      |  3 +++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/TrueFileFilter.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/TrueFileFilter.java
index 9a4a5ca..fd6fedb 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/TrueFileFilter.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/TrueFileFilter.java
@@ -34,8 +34,18 @@ public class TrueFileFilter implements FileFilter, Serializable {
 
     /**
      * Singleton instance of true filter.
+     *
+     * @since 2.10.0
+     */
+    public static final FileFilter INSTANCE = new TrueFileFilter();
+
+    /**
+     * Singleton instance of true filter.
+     *
+     * @deprecated Use {@link #INSTANCE}.
      */
-    public static final FileFilter TRUE = new TrueFileFilter();
+    @Deprecated
+    public static final FileFilter TRUE = INSTANCE;
 
     /**
      * Restrictive constructor.
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/NotFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/NotFileFilterTest.java
index 89f658b..985807d 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/NotFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/NotFileFilterTest.java
@@ -29,12 +29,15 @@ import org.junit.Test;
 // CHECKSTYLE:OFF Test code
 public class NotFileFilterTest extends BaseFilterTest {
 
+    @SuppressWarnings("deprecation")
     @Test
     public void testAccept() throws FileSystemException {
 
         final FileSelectInfo any = createFileSelectInfo(new File("test1.txt"));
 
+        Assert.assertFalse(new NotFileFilter(TrueFileFilter.INSTANCE).accept(any));
         Assert.assertFalse(new NotFileFilter(TrueFileFilter.TRUE).accept(any));
+        
         Assert.assertTrue(new NotFileFilter(FalseFileFilter.INSTANCE).accept(any));
         Assert.assertTrue(new NotFileFilter(FalseFileFilter.FALSE).accept(any));
 
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 25b87c0..f4dcfd9 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -84,6 +84,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="add" dev="ggregory" due-to="Gary Gregory">
         Add FalseFileFilter.INSTANCE and deprecate FalseFileFilter.FALSE.
       </action>
+      <action type="add" dev="ggregory" due-to="Gary Gregory">
+        Add TrueFileFilter.INSTANCE and deprecate TrueFileFilter.TRUE.
+      </action>
       <!-- UDPATE -->
       <action type="update" dev="ggregory" due-to="Dependabot">
         Bump jakarta.mail from 1.6.7 to 2.0.1 #200.