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/29 19:37:38 UTC
[commons-vfs] branch master updated: Fix Checkstyle issues, formatting, declutter examples.
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
The following commit(s) were added to refs/heads/master by this push:
new 189dea3 Fix Checkstyle issues, formatting, declutter examples.
189dea3 is described below
commit 189dea353537cb5862f1a26c3eb32871bfe7688e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Nov 29 14:37:34 2021 -0500
Fix Checkstyle issues, formatting, declutter examples.
---
checkstyle-suppressions.xml | 4 +-
.../vfs2/example/ChangeLastModificationTime.java | 7 ++++
.../org/apache/commons/vfs2/example/Shell.java | 18 ++++----
.../commons/vfs2/example/ShowProperties.java | 9 +++-
.../vfs2/example/filter/AgeFileFilterExample.java | 12 +++++-
.../example/filter/CanReadFileFilterExample.java | 48 ++++++++++------------
.../example/filter/CanWriteFileFilterExample.java | 38 ++++++++---------
.../example/filter/DirectoryFileFilterExample.java | 11 ++++-
.../example/filter/EmptyFileFilterExample.java | 36 ++++++++--------
.../vfs2/example/filter/FileFileFilterExample.java | 11 ++++-
.../example/filter/HiddenFileFilterExample.java | 36 ++++++++--------
.../vfs2/example/filter/NameFileFilterExample.java | 11 ++++-
.../example/filter/PrefixFileFilterExample.java | 11 ++++-
.../example/filter/RegexFileFilterExample.java | 14 +++++--
.../vfs2/example/filter/SizeFileFilterExample.java | 12 +++++-
.../example/filter/SuffixFileFilterExample.java | 11 ++++-
.../example/filter/WildcardFileFilterExample.java | 14 +++++--
.../vfs2/example/{ => filter}/package-info.java | 2 +-
.../apache/commons/vfs2/example/package-info.java | 2 +-
.../org/apache/commons/vfs2/libcheck/FtpCheck.java | 6 +++
.../apache/commons/vfs2/libcheck/SftpCheck.java | 6 +++
.../apache/commons/vfs2/libcheck/package-info.java | 4 +-
22 files changed, 211 insertions(+), 112 deletions(-)
diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml
index aebc5ce..354f8d0 100644
--- a/checkstyle-suppressions.xml
+++ b/checkstyle-suppressions.xml
@@ -45,9 +45,9 @@
<!-- Use of literals here is reasonable. -->
<suppress checks="MagicNumber" files="URIUtils.java" lines="142, 151, 161"/>
-
- <!-- Use of literals here is reasonable. -->
<suppress checks="MagicNumber" files="RamFileRandomAccessContent.java"/>
+ <suppress checks="MagicNumber" files="FtpCheck.java" lines="48, 28"/>
+ <suppress checks="MagicNumber" files="SftpCheck.java" lines="42, 28"/>
<!-- FileSystemOptions is a subclass of Object and uses the copy constructor pattern. -->
<suppress checks="SuperClone" files="FileSystemOptions.java"/>
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/ChangeLastModificationTime.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/ChangeLastModificationTime.java
index 0871e26..999c690 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/ChangeLastModificationTime.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/ChangeLastModificationTime.java
@@ -23,10 +23,17 @@ import org.apache.commons.vfs2.VFS;
* Example to change the last modification time of the given file.
*/
public final class ChangeLastModificationTime {
+
private ChangeLastModificationTime() {
/* main class not instantiated. */
}
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) throws Exception {
if (args.length == 0) {
System.err.println("Please pass the name of a file as parameter.");
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/Shell.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/Shell.java
index 63dbf34..1117c1f 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/Shell.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/Shell.java
@@ -71,6 +71,12 @@ public final class Shell {
reader = new BufferedReader(new InputStreamReader(System.in, Charset.defaultCharset()));
}
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) {
try {
new Shell().go();
@@ -138,16 +144,14 @@ public final class Shell {
if (cmd.length > 1) {
info(cmd[1]);
} else {
- System.out.println(
- "Default manager: \"" + mgr.getClass().getName() + "\" " + "version " + getVersion(mgr.getClass()));
+ System.out.println("Default manager: \"" + mgr.getClass().getName() + "\" " + "version " + getVersion(mgr.getClass()));
final String[] schemes = mgr.getSchemes();
final List<String> virtual = new ArrayList<>();
final List<String> physical = new ArrayList<>();
for (final String scheme : schemes) {
final Collection<Capability> caps = mgr.getProviderCapabilities(scheme);
if (caps != null) {
- if (caps.contains(Capability.VIRTUAL) || caps.contains(Capability.COMPRESS)
- || caps.contains(Capability.DISPATCHER)) {
+ if (caps.contains(Capability.VIRTUAL) || caps.contains(Capability.COMPRESS) || caps.contains(Capability.DISPATCHER)) {
virtual.add(scheme);
} else {
physical.add(scheme);
@@ -250,8 +254,7 @@ public final class Shell {
* Does a 'pwfs' command.
*/
private void pwfs() {
- System.out.println("FileSystem of current folder is " + cwd.getFileSystem() + " (root: "
- + cwd.getFileSystem().getRootURI() + ")");
+ System.out.println("FileSystem of current folder is " + cwd.getFileSystem() + " (root: " + cwd.getFileSystem().getRootURI() + ")");
}
/**
@@ -327,8 +330,7 @@ public final class Shell {
/**
* Lists the children of a folder.
*/
- private void listChildren(final FileObject dir, final boolean recursive, final String prefix)
- throws FileSystemException {
+ private void listChildren(final FileObject dir, final boolean recursive, final String prefix) throws FileSystemException {
final FileObject[] children = dir.getChildren();
for (final FileObject child : children) {
System.out.print(prefix);
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/ShowProperties.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/ShowProperties.java
index c9ae26f..b4c7804 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/ShowProperties.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/ShowProperties.java
@@ -36,6 +36,12 @@ public final class ShowProperties {
/* main class not instantiated. */
}
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) {
if (args.length == 0) {
System.err.println("Please pass the name of a file as parameter.");
@@ -75,8 +81,7 @@ public final class ShowProperties {
}
}
}
- System.out.println("Last modified: "
- + DateFormat.getInstance().format(new Date(file.getContent().getLastModifiedTime())));
+ System.out.println("Last modified: " + DateFormat.getInstance().format(new Date(file.getContent().getLastModifiedTime())));
} else {
System.out.println("The file does not exist");
}
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/AgeFileFilterExample.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/AgeFileFilterExample.java
index bba4cb5..36b0c4a 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/AgeFileFilterExample.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/AgeFileFilterExample.java
@@ -28,8 +28,17 @@ import org.apache.commons.vfs2.filter.AgeFileFilter;
* Example for using {@link AgeFileFilter}.
*/
// CHECKSTYLE:OFF Example code
-public class AgeFileFilterExample {
+public final class AgeFileFilterExample {
+ private AgeFileFilterExample() {
+ /* main class not instantiated. */
+ }
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) throws Exception {
final FileSystemManager fsManager = VFS.getManager();
@@ -48,4 +57,3 @@ public class AgeFileFilterExample {
}
// CHECKSTYLE:ON
-
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/CanReadFileFilterExample.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/CanReadFileFilterExample.java
index efd7e9f..725ed02 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/CanReadFileFilterExample.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/CanReadFileFilterExample.java
@@ -28,49 +28,43 @@ import org.apache.commons.vfs2.filter.CanReadFileFilter;
* Example for using {@link CanReadFileFilter}.
*/
// CHECKSTYLE:OFF Example code
-public class CanReadFileFilterExample {
+public final class CanReadFileFilterExample {
+ private CanReadFileFilterExample() {
+ /* main class not instantiated. */
+ }
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) throws Exception {
+ final FileSystemManager fsManager = VFS.getManager();
+ final FileObject dir = fsManager.toFileObject(new File("."));
// Example, showing how to print out a list of the current directory's
// readable files:
- {
- System.out.println("---CAN_READ---");
- final FileSystemManager fsManager = VFS.getManager();
- final FileObject dir = fsManager.toFileObject(new File("."));
- final FileObject[] files = dir.findFiles(new FileFilterSelector(CanReadFileFilter.CAN_READ));
- for (final FileObject file : files) {
- System.out.println(file);
- }
+ System.out.println("---CAN_READ---");
+ for (final FileObject file : dir.findFiles(new FileFilterSelector(CanReadFileFilter.CAN_READ))) {
+ System.out.println(file);
}
// Example, showing how to print out a list of the current directory's
// un-readable files:
- {
- System.out.println("---CANNOT_READ---");
- final FileSystemManager fsManager = VFS.getManager();
- final FileObject dir = fsManager.toFileObject(new File("."));
- final FileObject[] files = dir
- .findFiles(new FileFilterSelector(CanReadFileFilter.CANNOT_READ));
- for (final FileObject file : files) {
- System.out.println(file);
- }
+ System.out.println("---CANNOT_READ---");
+ for (final FileObject file : dir.findFiles(new FileFilterSelector(CanReadFileFilter.CANNOT_READ))) {
+ System.out.println(file);
}
// Example, showing how to print out a list of the current directory's
// read-only files:
- {
- System.out.println("---READ_ONLY---");
- final FileSystemManager fsManager = VFS.getManager();
- final FileObject dir = fsManager.toFileObject(new File("."));
- final FileObject[] files = dir.findFiles(new FileFilterSelector(CanReadFileFilter.READ_ONLY));
- for (final FileObject file : files) {
- System.out.println(file);
- }
+ System.out.println("---READ_ONLY---");
+ for (final FileObject file : dir.findFiles(new FileFilterSelector(CanReadFileFilter.READ_ONLY))) {
+ System.out.println(file);
}
}
}
// CHECKSTYLE:ON
-
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/CanWriteFileFilterExample.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/CanWriteFileFilterExample.java
index 99de851..9b2fba6 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/CanWriteFileFilterExample.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/CanWriteFileFilterExample.java
@@ -28,38 +28,36 @@ import org.apache.commons.vfs2.filter.CanWriteFileFilter;
* Example for using {@link CanWriteFileFilter}.
*/
// CHECKSTYLE:OFF Example code
-public class CanWriteFileFilterExample {
+public final class CanWriteFileFilterExample {
+ private CanWriteFileFilterExample() {
+ /* main class not instantiated. */
+ }
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) throws Exception {
+ final FileSystemManager fsManager = VFS.getManager();
+ final FileObject dir = fsManager.toFileObject(new File("."));
// Example, showing how to print out a list of the current directory's
// writable files:
- {
- System.out.println("---CAN_WRITE---");
- final FileSystemManager fsManager = VFS.getManager();
- final FileObject dir = fsManager.toFileObject(new File("."));
- final FileObject[] files = dir
- .findFiles(new FileFilterSelector(CanWriteFileFilter.CAN_WRITE));
- for (final FileObject file : files) {
- System.out.println(file);
- }
+ System.out.println("---CAN_WRITE---");
+ for (final FileObject file : dir.findFiles(new FileFilterSelector(CanWriteFileFilter.CAN_WRITE))) {
+ System.out.println(file);
}
// Example, showing how to print out a list of the current directory's
// un-writable files:
- {
- System.out.println("---CANNOT_WRITE---");
- final FileSystemManager fsManager = VFS.getManager();
- final FileObject dir = fsManager.toFileObject(new File("."));
- final FileObject[] files = dir.findFiles(new FileFilterSelector(
- CanWriteFileFilter.CANNOT_WRITE));
- for (final FileObject file : files) {
- System.out.println(file);
- }
+ System.out.println("---CANNOT_WRITE---");
+ for (final FileObject file : dir.findFiles(new FileFilterSelector(CanWriteFileFilter.CANNOT_WRITE))) {
+ System.out.println(file);
}
}
}
// CHECKSTYLE:ON
-
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/DirectoryFileFilterExample.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/DirectoryFileFilterExample.java
index 6d8d373..a2bf1ab 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/DirectoryFileFilterExample.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/DirectoryFileFilterExample.java
@@ -28,8 +28,17 @@ import org.apache.commons.vfs2.filter.DirectoryFileFilter;
* Example for using {@link DirectoryFileFilter}.
*/
// CHECKSTYLE:OFF Example code
-public class DirectoryFileFilterExample {
+public final class DirectoryFileFilterExample {
+ private DirectoryFileFilterExample() {
+ /* main class not instantiated. */
+ }
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) throws Exception {
// Example, how to print out a list of the current directory's
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/EmptyFileFilterExample.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/EmptyFileFilterExample.java
index 662e721..145b102 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/EmptyFileFilterExample.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/EmptyFileFilterExample.java
@@ -28,32 +28,34 @@ import org.apache.commons.vfs2.filter.EmptyFileFilter;
* Example for using {@link EmptyFileFilter}.
*/
// CHECKSTYLE:OFF Example code
-public class EmptyFileFilterExample {
+public final class EmptyFileFilterExample {
+ private EmptyFileFilterExample() {
+ /* main class not instantiated. */
+ }
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) throws Exception {
+ final FileSystemManager fsManager = VFS.getManager();
+ final FileObject dir = fsManager.toFileObject(new File("."));
+
// Example, showing how to print out a list of the current directory's
// empty files/directories
- {
- System.out.println("---EMPTY---");
- final FileSystemManager fsManager = VFS.getManager();
- final FileObject dir = fsManager.toFileObject(new File("."));
- final FileObject[] files = dir.findFiles(new FileFilterSelector(EmptyFileFilter.EMPTY));
- for (final FileObject file : files) {
- System.out.println(file);
- }
+ System.out.println("---EMPTY---");
+ for (final FileObject file : dir.findFiles(new FileFilterSelector(EmptyFileFilter.EMPTY))) {
+ System.out.println(file);
}
// Example, showing how to print out a list of the current directory's
// non-empty files/directories
- {
- System.out.println("---NOT_EMPTY---");
- final FileSystemManager fsManager = VFS.getManager();
- final FileObject dir = fsManager.toFileObject(new File("."));
- final FileObject[] files = dir.findFiles(new FileFilterSelector(EmptyFileFilter.NOT_EMPTY));
- for (final FileObject file : files) {
- System.out.println(file);
- }
+ System.out.println("---NOT_EMPTY---");
+ for (final FileObject file : dir.findFiles(new FileFilterSelector(EmptyFileFilter.NOT_EMPTY))) {
+ System.out.println(file);
}
}
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/FileFileFilterExample.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/FileFileFilterExample.java
index 00c52eb..ff53b04 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/FileFileFilterExample.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/FileFileFilterExample.java
@@ -28,8 +28,17 @@ import org.apache.commons.vfs2.filter.FileFileFilter;
* Example for using {@link FileFileFilter}.
*/
// CHECKSTYLE:OFF Example code
-public class FileFileFilterExample {
+public final class FileFileFilterExample {
+ private FileFileFilterExample() {
+ /* main class not instantiated. */
+ }
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) throws Exception {
// Example, how to print out a list of the real files within the current
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/HiddenFileFilterExample.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/HiddenFileFilterExample.java
index 37c89e2..5db6e71 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/HiddenFileFilterExample.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/HiddenFileFilterExample.java
@@ -28,32 +28,34 @@ import org.apache.commons.vfs2.filter.HiddenFileFilter;
* Example for using {@link HiddenFileFilter}.
*/
// CHECKSTYLE:OFF Example code
-public class HiddenFileFilterExample {
+public final class HiddenFileFilterExample {
+ private HiddenFileFilterExample() {
+ /* main class not instantiated. */
+ }
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) throws Exception {
+ final FileSystemManager fsManager = VFS.getManager();
+ final FileObject dir = fsManager.toFileObject(new File("."));
+
// Example, showing how to print out a list of the current directory's
// hidden files
- {
- System.out.println("---HIDDEN---");
- final FileSystemManager fsManager = VFS.getManager();
- final FileObject dir = fsManager.toFileObject(new File("."));
- final FileObject[] files = dir.findFiles(new FileFilterSelector(HiddenFileFilter.HIDDEN));
- for (final FileObject file : files) {
- System.out.println(file);
- }
+ System.out.println("---HIDDEN---");
+ for (final FileObject file : dir.findFiles(new FileFilterSelector(HiddenFileFilter.HIDDEN))) {
+ System.out.println(file);
}
// Example, showing how to print out a list of the current directory's
// visible (i.e. not hidden) files
- {
- System.out.println("---VISIBLE---");
- final FileSystemManager fsManager = VFS.getManager();
- final FileObject dir = fsManager.toFileObject(new File("."));
- final FileObject[] files = dir.findFiles(new FileFilterSelector(HiddenFileFilter.VISIBLE));
- for (final FileObject file : files) {
- System.out.println(file);
- }
+ System.out.println("---VISIBLE---");
+ for (final FileObject file : dir.findFiles(new FileFilterSelector(HiddenFileFilter.VISIBLE))) {
+ System.out.println(file);
}
}
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/NameFileFilterExample.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/NameFileFilterExample.java
index a2980cb..b6d0543 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/NameFileFilterExample.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/NameFileFilterExample.java
@@ -28,8 +28,17 @@ import org.apache.commons.vfs2.filter.NameFileFilter;
* Example for using {@link NameFileFilter}.
*/
// CHECKSTYLE:OFF Example code
-public class NameFileFilterExample {
+public final class NameFileFilterExample {
+ private NameFileFilterExample() {
+ /* main class not instantiated. */
+ }
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) throws Exception {
// Example, to print all files and directories in the current directory
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/PrefixFileFilterExample.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/PrefixFileFilterExample.java
index 4cd0bdf..55ef520 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/PrefixFileFilterExample.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/PrefixFileFilterExample.java
@@ -28,8 +28,17 @@ import org.apache.commons.vfs2.filter.PrefixFileFilter;
* Example for using {@link PrefixFileFilter}.
*/
// CHECKSTYLE:OFF Example code
-public class PrefixFileFilterExample {
+public final class PrefixFileFilterExample {
+ private PrefixFileFilterExample() {
+ /* main class not instantiated. */
+ }
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) throws Exception {
// Example, to print all files and directories in the current directory
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/RegexFileFilterExample.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/RegexFileFilterExample.java
index 5250a79..268d500 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/RegexFileFilterExample.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/RegexFileFilterExample.java
@@ -28,16 +28,24 @@ import org.apache.commons.vfs2.filter.RegexFileFilter;
* Example for using {@link RegexFileFilter}.
*/
// CHECKSTYLE:OFF Example code
-public class RegexFileFilterExample {
+public final class RegexFileFilterExample {
+ private RegexFileFilterExample() {
+ /* main class not instantiated. */
+ }
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) throws Exception {
// Example, to retrieve and print all java files where the name matched
// the regular expression in the current directory
final FileSystemManager fsManager = VFS.getManager();
final FileObject dir = fsManager.toFileObject(new File("."));
- final FileObject[] files = dir.findFiles(new FileFilterSelector(new RegexFileFilter(
- "ˆ.*[tT]est(-\\d+)?\\.java$")));
+ final FileObject[] files = dir.findFiles(new FileFilterSelector(new RegexFileFilter("ˆ.*[tT]est(-\\d+)?\\.java$")));
for (final FileObject file : files) {
System.out.println(file);
}
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/SizeFileFilterExample.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/SizeFileFilterExample.java
index ded3336..08e04de 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/SizeFileFilterExample.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/SizeFileFilterExample.java
@@ -28,8 +28,17 @@ import org.apache.commons.vfs2.filter.SizeFileFilter;
* Example for using {@link SizeFileFilter}.
*/
// CHECKSTYLE:OFF Example code
-public class SizeFileFilterExample {
+public final class SizeFileFilterExample {
+ private SizeFileFilterExample() {
+ /* main class not instantiated. */
+ }
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) throws Exception {
// Example, to print all files and directories in the current directory
@@ -46,4 +55,3 @@ public class SizeFileFilterExample {
}
// CHECKSTYLE:ON
-
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/SuffixFileFilterExample.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/SuffixFileFilterExample.java
index ee647f1..263d15d 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/SuffixFileFilterExample.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/SuffixFileFilterExample.java
@@ -28,8 +28,17 @@ import org.apache.commons.vfs2.filter.SuffixFileFilter;
* Example for using {@link SuffixFileFilter}.
*/
// CHECKSTYLE:OFF Example code
-public class SuffixFileFilterExample {
+public final class SuffixFileFilterExample {
+ private SuffixFileFilterExample() {
+ /* main class not instantiated. */
+ }
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) throws Exception {
// Example, to retrieve and print all *.java files in the current
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/WildcardFileFilterExample.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/WildcardFileFilterExample.java
index 8f452a1..ea66802 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/WildcardFileFilterExample.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/WildcardFileFilterExample.java
@@ -28,16 +28,24 @@ import org.apache.commons.vfs2.filter.WildcardFileFilter;
* Example for using {@link WildcardFileFilter}.
*/
// CHECKSTYLE:OFF Example code
-public class WildcardFileFilterExample {
+public final class WildcardFileFilterExample {
+ private WildcardFileFilterExample() {
+ /* main class not instantiated. */
+ }
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) throws Exception {
// Example, to retrieve and print all java files that have the
// expression test in the name in the current directory
final FileSystemManager fsManager = VFS.getManager();
final FileObject dir = fsManager.toFileObject(new File("."));
- final FileObject[] files = dir.findFiles(new FileFilterSelector(new WildcardFileFilter(
- "*test*.java")));
+ final FileObject[] files = dir.findFiles(new FileFilterSelector(new WildcardFileFilter("*test*.java")));
for (final FileObject file : files) {
System.out.println(file);
}
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/package-info.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/package-info.java
similarity index 95%
copy from commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/package-info.java
copy to commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/package-info.java
index 3c1787a..a61531b 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/package-info.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/package-info.java
@@ -16,6 +16,6 @@
*/
/**
- * Apache Commons VFS Examples classes.
+ * Apache Commons VFS Examples.
*/
package org.apache.commons.vfs2.example;
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/package-info.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/package-info.java
index 3c1787a..a61531b 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/package-info.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/package-info.java
@@ -16,6 +16,6 @@
*/
/**
- * Apache Commons VFS Examples classes.
+ * Apache Commons VFS Examples.
*/
package org.apache.commons.vfs2.example;
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/FtpCheck.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/FtpCheck.java
index bb3d91e..4b788fa 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/FtpCheck.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/FtpCheck.java
@@ -31,6 +31,12 @@ public final class FtpCheck {
/* main class not instantiated. */
}
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) throws Exception {
if (args.length < 3) {
throw new IllegalArgumentException("Usage: FtpCheck user pass host dir");
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/SftpCheck.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/SftpCheck.java
index e865f2f..fa80792 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/SftpCheck.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/SftpCheck.java
@@ -32,6 +32,12 @@ public final class SftpCheck {
/* main class not instantiated. */
}
+ /**
+ * Invokes this example from the command line.
+ *
+ * @param args Arguments TODO
+ * @throws Exception If anything goes wrong.
+ */
public static void main(final String[] args) throws Exception {
if (args.length != 4) {
throw new IllegalArgumentException("Usage: SftpCheck user pass host dir");
diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/package-info.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/package-info.java
index 2ceb851..21a79c1 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/package-info.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/package-info.java
@@ -19,8 +19,8 @@
* Sample clients for commons-net.ftp and JSch libraries.
*
* <p>
- * The classes do not use the VFS library, but can be used to test the
- * underlying libraries, if they can connect to a specified service.
+ * The classes do not use the VFS library, but can be used to test the underlying libraries, if they can connect to a
+ * specified service.
* </p>
*/
package org.apache.commons.vfs2.libcheck;