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 21:55:56 UTC

[commons-vfs] branch master updated (176acdc -> 79ccafd)

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 176acdc  Fix Checkstyle WhitespaceAround.
     new fa3ff72  Fix Checkstyle GenericWhitespace.
     new b0b088e  Fix Checkstyle LeftCurly.
     new 79ccafd  Add missing Javadocs.

The 3 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:
 .../commons/vfs2/provider/AbstractFileObject.java  |   4 +-
 .../commons/vfs2/provider/DefaultFileContent.java  |   7 +-
 .../commons/vfs2/provider/ftp/FtpClient.java       | 140 +++++++++++++++++++--
 .../vfs2/provider/http4/Http4FileProvider.java     |  20 +--
 .../commons/vfs2/tasks/AbstractSyncTask.java       |   5 +-
 5 files changed, 148 insertions(+), 28 deletions(-)

[commons-vfs] 01/03: Fix Checkstyle GenericWhitespace.

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 fa3ff72c7915b60809576b3b1abf007290ef9d95
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 27 16:27:12 2021 -0500

    Fix Checkstyle GenericWhitespace.
---
 .../vfs2/provider/http4/Http4FileProvider.java       | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileProvider.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileProvider.java
index ca8cc5d..a2305ed 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileProvider.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileProvider.java
@@ -122,22 +122,22 @@ public class Http4FileProvider extends AbstractOriginatingFileProvider {
     private HttpClientConnectionManager createConnectionManager(final Http4FileSystemConfigBuilder builder,
         final FileSystemOptions fileSystemOptions, final SSLContext sslContext, final HostnameVerifier verifier) {
         final SSLConnectionSocketFactory sslFactory = new SSLConnectionSocketFactory(sslContext, verifier);
-        final Registry<ConnectionSocketFactory> socketFactoryRegistry =
-                RegistryBuilder.<ConnectionSocketFactory> create()
-                        .register("https", sslFactory)
-                        .register("http", new PlainConnectionSocketFactory())
-                        .build();
+        // @formatter:off
+        final Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
+            .register("https", sslFactory)
+            .register("http", new PlainConnectionSocketFactory())
+            .build();
+        // @formatter:on
 
         final PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
         connManager.setMaxTotal(builder.getMaxTotalConnections(fileSystemOptions));
         connManager.setDefaultMaxPerRoute(builder.getMaxConnectionsPerHost(fileSystemOptions));
 
         // @formatter:off
-        final SocketConfig socketConfig =
-                SocketConfig
-                .custom()
-                .setSoTimeout(DurationUtils.toMillisInt(builder.getSoTimeoutDuration(fileSystemOptions)))
-                .build();
+        final SocketConfig socketConfig = SocketConfig
+            .custom()
+            .setSoTimeout(DurationUtils.toMillisInt(builder.getSoTimeoutDuration(fileSystemOptions)))
+            .build();
         // @formatter:on
 
         connManager.setDefaultSocketConfig(socketConfig);

[commons-vfs] 02/03: Fix Checkstyle LeftCurly.

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 b0b088e29ca3e8477451b27aae7c52de9bacbeaa
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 27 16:29:41 2021 -0500

    Fix Checkstyle LeftCurly.
---
 .../java/org/apache/commons/vfs2/provider/AbstractFileObject.java  | 4 ++--
 .../java/org/apache/commons/vfs2/provider/DefaultFileContent.java  | 7 +++----
 .../main/java/org/apache/commons/vfs2/tasks/AbstractSyncTask.java  | 5 +----
 3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
index 2a8ceb2..06ed144 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
@@ -1285,8 +1285,8 @@ public abstract class AbstractFileObject<AFS extends AbstractFileSystem> impleme
      */
     @Override
     public FileObject getParent() throws FileSystemException {
-        if (this.compareTo(fileSystem.getRoot()) == 0) // equals is not implemented :-/
-        {
+        // equals is not implemented :-/
+        if (this.compareTo(fileSystem.getRoot()) == 0) {
             if (fileSystem.getParentLayer() == null) {
                 // Root file has no parent
                 return null;
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java
index cdb32c8..3f43f2b 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java
@@ -497,8 +497,8 @@ public final class DefaultFileContent implements FileContent {
 
     private InputStream buildInputStream(final int bufferSize) throws FileSystemException {
         /*
-         * if (getThreadData().getState() == STATE_WRITING || getThreadData().getState() == STATE_RANDOM_ACCESS) { throw
-         * new FileSystemException("vfs.provider/read-in-use.error", file); }
+         * if (getThreadData().getState() == STATE_WRITING || getThreadData().getState() == STATE_RANDOM_ACCESS) { throw new
+         * FileSystemException("vfs.provider/read-in-use.error", file); }
          */
         // Get the raw input stream
         // @formatter:off
@@ -515,8 +515,7 @@ public final class DefaultFileContent implements FileContent {
         if (inputStream instanceof BufferedInputStream) {
             // Don't double buffer.
             wrappedInputStream = new RawFileContentInputStream(fileObject, inputStream);
-        } else
-        {
+        } else {
             // @formatter:off
             wrappedInputStream = bufferSize == 0
                     ? new FileContentInputStream(fileObject, inputStream)
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/tasks/AbstractSyncTask.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/tasks/AbstractSyncTask.java
index 3ac3663..a979a58 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/tasks/AbstractSyncTask.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/tasks/AbstractSyncTask.java
@@ -294,10 +294,7 @@ public abstract class AbstractSyncTask extends VfsTask {
     /**
      * Handles a single file, checking for collisions where more than one source file maps to the same destination file.
      */
-    private void handleFile(final Set<FileObject> destFiles, final FileObject srcFile, final FileObject destFile)
-            throws Exception
-
-    {
+    private void handleFile(final Set<FileObject> destFiles, final FileObject srcFile, final FileObject destFile) throws Exception {
         // Check for duplicate source files
         if (destFiles.contains(destFile)) {
             final String message = Messages.getString("vfs.tasks/sync.duplicate-source-files.warn", destFile);

[commons-vfs] 03/03: Add missing Javadocs.

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 79ccafd0fda2edeb5732f75305b4306897f2640c
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 27 16:55:29 2021 -0500

    Add missing Javadocs.
---
 .../commons/vfs2/provider/ftp/FtpClient.java       | 140 +++++++++++++++++++--
 1 file changed, 132 insertions(+), 8 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpClient.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpClient.java
index 395e8da..88038ea 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpClient.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpClient.java
@@ -30,20 +30,68 @@ import org.apache.commons.vfs2.FileSystemException;
  */
 public interface FtpClient {
 
+    /**
+     * Aborts the current operation.
+     *
+     * @return true if aborted.
+     * @throws IOException If an I/O error occurs
+     */
     boolean abort() throws IOException;
 
+    /**
+     * Returns an OutputStream through which data can be written to append to a file on the server with the given name.
+     *
+     * @param relPath The name of the remote file.
+     * @return An OutputStream through which the remote file can be appended.
+     * @throws IOException If an I/O error occurs.
+     */
     OutputStream appendFileStream(String relPath) throws IOException;
 
+    /**
+     * There are a few FTPClient methods that do not complete the entire sequence of FTP commands to complete a transaction.
+     * These commands require some action by the programmer after the reception of a positive intermediate command. After
+     * the programmer's code completes its actions, it must call this method to receive the completion reply from the server
+     * and verify the success of the entire transaction.
+     *
+     * @return true if successfully completed, false if not.
+     * @throws IOException If an I/O error occurs.
+     */
     boolean completePendingCommand() throws IOException;
 
+    /**
+     * Deletes a file on the FTP server.
+     *
+     * @param relPath The relPath of the file to be deleted.
+     * @return true if successfully completed, false if not.
+     * @throws IOException If an I/O error occurs.
+     */
     boolean deleteFile(String relPath) throws IOException;
 
+    /**
+     * Sends the FTP QUIT command to the server, receive the reply, and return the reply code.
+     *
+     * @throws IOException If an I/O error occurs.
+     */
     void disconnect() throws IOException;
 
+    /**
+     * Gets the integer value of the reply code of the last FTP reply.
+     *
+     * @return The integer value of the reply code of the last FTP reply.
+     * @throws IOException If an I/O error occurs.
+     */
+    @SuppressWarnings("unused")
     default int getReplyCode() throws IOException {
         return FTPReply.COMMAND_OK;
     }
 
+    /**
+     * Gets the entire text of the last FTP server response exactly as it was received, including all end of line markers in
+     * NETASCII format.
+     *
+     * @return The entire text from the last FTP response as a String.
+     * @throws IOException If an I/O error occurs.
+     */
     String getReplyString() throws IOException;
 
     /**
@@ -53,53 +101,129 @@ public interface FtpClient {
      * @return {@code true} if the feature is present, {@code false} if the feature is not present or the FTP command
      *         failed.
      *
-     * @throws IOException on error
+     * @throws IOException If an I/O error occurs.
      * @since 2.8.0
      */
     boolean hasFeature(String feature) throws IOException;
 
+    /**
+     * Tests if the client is currently connected to a server.
+     *
+     * @return true if the client is currently connected to a server, false otherwise.
+     * @throws FileSystemException If an I/O error occurs.
+     */
     boolean isConnected() throws FileSystemException;
 
-    // This interface should not leak Apache Commons NET types like FTPFile
+    /**
+     * Using the default system autodetect mechanism, obtain a list of file information for the current working directory or
+     * for just a single file.
+     * <p>
+     * TODO This interface should not leak Apache Commons NET types like FTPFile
+     * </p>
+     *
+     * @param relPath The file or directory to list.
+     * @return an array of FTPFile.
+     * @throws IOException If an I/O error occurs.
+     */
     FTPFile[] listFiles(String relPath) throws IOException;
 
+    /**
+     * Creates a new sub-directory on the FTP server in the current directory (if a relative pathname is given) or where
+     * specified (if an absolute pathname is given).
+     *
+     * @param relPath The pathname of the directory to create.
+     * @return true if successfully completed, false if not.
+     * @throws IOException If an I/O error occurs.
+     */
     boolean makeDirectory(String relPath) throws IOException;
 
     /**
-     * Sends the MDTM command to get a file's date and time information after file transfer. It is typically more
-     * accurate than the {@code "LIST"} command response. Time values are always represented in UTC (GMT), and in the
-     * Gregorian calendar regardless of what calendar may have been in use at the date and time the file was last
-     * modified.
+     * Sends the MDTM command to get a file's date and time information after file transfer. It is typically more accurate
+     * than the {@code "LIST"} command response. Time values are always represented in UTC (GMT), and in the Gregorian
+     * calendar regardless of what calendar may have been in use at the date and time the file was last modified.
      * <p>
      * NOTE: not all remote FTP servers support {@code MDTM}.
      * </p>
      *
      * @param relPath The relative path of the file object to execute {@code MDTM} command against
      * @return new {@code Instant} object containing the {@code MDTM} timestamp.
-     * @throws IOException If the underlying FTP client encountered an error.
+     * @throws IOException If an I/O error occurs.
      * @since 2.8.0
      */
+    @SuppressWarnings("unused")
     default Instant mdtmInstant(final String relPath) throws IOException {
         return null;
     }
 
+    /**
+     * Removes a directory on the FTP server (if empty).
+     *
+     * @param relPath The pathname of the directory to remove.
+     * @return true if successfully completed, false if not.
+     * @throws IOException If an I/O error occurs.
+     */
     boolean removeDirectory(String relPath) throws IOException;
 
-    boolean rename(String oldName, String newName) throws IOException;
+    /**
+     * Renames a remote file.
+     *
+     * @param from The name of the remote file to rename.
+     * @param to The new name of the remote file.
+     * @return true if successfully completed, false if not.
+     * @throws IOException If an I/O error occurs.
+     */
+    boolean rename(String from, String to) throws IOException;
 
+    /**
+     * Returns an InputStream from which a named file from the server can be read.
+     *
+     * @param relPath The name of the remote file.
+     * @return An InputStream from which the remote file can be read.
+     * @throws IOException If an I/O error occurs.
+     */
     InputStream retrieveFileStream(String relPath) throws IOException;
 
+    /**
+     * Returns an InputStream from which a named file from the server can be read.
+     *
+     * @param relPath The name of the remote file.
+     * @param bufferSize buffer size.
+     * @return An InputStream from which the remote file can be read.
+     * @throws IOException If an I/O error occurs.
+     */
     default InputStream retrieveFileStream(final String relPath, final int bufferSize) throws IOException {
         // Backward compatibility: no buffer size.
         return retrieveFileStream(relPath);
     }
 
+    /**
+     * Returns an InputStream from which a named file from the server can be read.
+     *
+     * @param relPath The name of the remote file.
+     * @param restartOffset restart offset.
+     * @return An InputStream from which the remote file can be read.
+     * @throws IOException If an I/O error occurs.
+     */
     InputStream retrieveFileStream(String relPath, long restartOffset) throws IOException;
 
+    /**
+     * Sets the buffer size for buffered data streams.
+     *
+     * @param bufferSize The size of the buffer.
+     * @throws FileSystemException If an I/O error occurs.
+     */
+    @SuppressWarnings("unused")
     default void setBufferSize(final int bufferSize) throws FileSystemException {
         // Backward compatibility: do nothing.
     }
 
+    /**
+     * Returns an OutputStream through which data can be written to store a file on the server using the given name.
+     *
+     * @param relPath The name to give the remote file.
+     * @return An OutputStream through which the remote file can be written.
+     * @throws IOException If an I/O error occurs.
+     */
     OutputStream storeFileStream(String relPath) throws IOException;
 
 }