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 2024/08/12 11:11:52 UTC

(commons-vfs) branch master updated (22d5201f -> 243ed5b0)

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 22d5201f Prepare for the next release candidate
     new 123416b9 Better comment
     new 6e976b81 Better comment
     new ffa02464 Javadoc
     new 654bcf11 Add FileSystemConfigBuilder.getParamOrDefault(FileSystemOptions, String, T)
     new cdacc5c5 Javadoc constructors
     new 243ed5b0 Javadoc

The 6 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/tasks/AbstractSyncTask.java       |  6 ++++++
 commons-vfs2-distribution/pom.xml                  |  2 +-
 commons-vfs2-distribution/src/assembly/bin.xml     | 11 +++++------
 .../vfs2/provider/webdav/WebdavFileObject.java     | 15 +++++++++++++--
 .../vfs2/provider/webdav/WebdavFileSystem.java     | 11 +++++++++--
 .../vfs2/provider/webdav4/Webdav4FileSystem.java   |  8 ++++++++
 .../commons/vfs2/provider/smb/SmbFileName.java     | 13 +++++++++++++
 .../commons/vfs2/provider/smb/SmbFileObject.java   | 11 +++++++++--
 .../commons/vfs2/FileSystemConfigBuilder.java      | 17 ++++++++++++++++-
 .../org/apache/commons/vfs2/FileSystemOptions.java |  7 ++++++-
 .../commons/vfs2/filter/SizeRangeFileFilter.java   |  9 ++++++---
 .../commons/vfs2/provider/GenericFileName.java     | 12 ++++++++++++
 .../vfs2/provider/bzip2/Bzip2FileObject.java       | 11 +++++++++--
 .../compressed/CompressedFileFileObject.java       | 11 +++++++++--
 .../commons/vfs2/provider/ftp/FtpFileObject.java   | 14 +++++++++++---
 .../commons/vfs2/provider/gzip/GzipFileObject.java | 11 +++++++++--
 .../commons/vfs2/provider/http/HttpFileObject.java | 21 +++++++++++++++++----
 .../commons/vfs2/provider/http/HttpFileSystem.java | 15 +++++++++++----
 .../vfs2/provider/http4/Http4FileSystem.java       |  2 +-
 .../commons/vfs2/provider/jar/JarFileObject.java   | 15 ++++++++++++---
 .../commons/vfs2/provider/local/LocalFileName.java |  8 ++++++++
 .../vfs2/provider/local/WindowsFileName.java       |  8 ++++++++
 .../commons/vfs2/provider/ram/RamFileObject.java   | 10 ++++++----
 .../vfs2/provider/res/ResourceFileName.java        |  7 +++++++
 .../commons/vfs2/provider/sftp/SftpFileObject.java | 13 ++++++++++---
 .../provider/sftp/SftpFileSystemConfigBuilder.java |  4 ++++
 .../commons/vfs2/provider/tar/TarFileObject.java   | 12 ++++++++++--
 .../commons/vfs2/provider/tar/TarFileSystem.java   | 12 +++++++++++-
 .../commons/vfs2/provider/url/UrlFileObject.java   | 22 +++++++++++++++++-----
 .../commons/vfs2/provider/url/UrlFileSystem.java   |  6 ++++++
 .../commons/vfs2/provider/zip/ZipFileObject.java   | 13 ++++++++++---
 .../commons/vfs2/provider/zip/ZipFileSystem.java   | 11 ++++++++---
 .../provider/zip/ZipFileSystemConfigBuilder.java   |  8 ++++++--
 .../commons/vfs2/util/WeakRefFileListener.java     |  6 ++++++
 .../zip/ZipProviderWithCharsetNullTestCase.java    |  3 ++-
 pom.xml                                            |  2 +-
 src/changes/changes.xml                            |  6 ++++++
 37 files changed, 309 insertions(+), 64 deletions(-)


(commons-vfs) 03/06: Javadoc

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 ffa024643d62ee99ff61387f7531a5fb8c59fa1b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Aug 11 10:11:42 2024 -0400

    Javadoc
---
 .../org/apache/commons/vfs2/tasks/AbstractSyncTask.java   |  6 ++++++
 commons-vfs2-distribution/src/assembly/bin.xml            | 11 +++++------
 .../commons/vfs2/provider/webdav/WebdavFileObject.java    | 15 +++++++++++++--
 .../commons/vfs2/provider/webdav/WebdavFileSystem.java    | 12 ++++++++++--
 .../commons/vfs2/provider/webdav4/Webdav4FileSystem.java  |  8 ++++++++
 .../org/apache/commons/vfs2/FileSystemConfigBuilder.java  |  2 +-
 .../apache/commons/vfs2/filter/SizeRangeFileFilter.java   |  9 ++++++---
 .../apache/commons/vfs2/provider/http/HttpFileObject.java | 11 +++++++++--
 .../apache/commons/vfs2/provider/http/HttpFileSystem.java | 15 +++++++++++----
 .../commons/vfs2/provider/http4/Http4FileSystem.java      |  2 +-
 .../vfs2/provider/sftp/SftpFileSystemConfigBuilder.java   |  4 ++++
 .../apache/commons/vfs2/provider/zip/ZipFileSystem.java   |  4 ++++
 .../vfs2/provider/zip/ZipFileSystemConfigBuilder.java     |  3 +++
 13 files changed, 81 insertions(+), 21 deletions(-)

diff --git a/commons-vfs2-ant/src/main/java/org/apache/commons/vfs2/tasks/AbstractSyncTask.java b/commons-vfs2-ant/src/main/java/org/apache/commons/vfs2/tasks/AbstractSyncTask.java
index 1be3a934..9aaaf1be 100644
--- a/commons-vfs2-ant/src/main/java/org/apache/commons/vfs2/tasks/AbstractSyncTask.java
+++ b/commons-vfs2-ant/src/main/java/org/apache/commons/vfs2/tasks/AbstractSyncTask.java
@@ -349,6 +349,12 @@ public abstract class AbstractSyncTask extends VfsTask {
         return failOnError;
     }
 
+    /**
+     * Logs a message or throws a {@link BuildException} depending on {@link #isFailonerror()}.
+     *
+     * @param message The message to using in logging or BuildException.
+     * @param level The log level.
+     */
     protected void logOrDie(final String message, final int level) {
         if (!isFailonerror()) {
             log(message, level);
diff --git a/commons-vfs2-distribution/src/assembly/bin.xml b/commons-vfs2-distribution/src/assembly/bin.xml
index 40e6f176..e6120b9b 100644
--- a/commons-vfs2-distribution/src/assembly/bin.xml
+++ b/commons-vfs2-distribution/src/assembly/bin.xml
@@ -22,11 +22,9 @@ limitations under the License.
     <format>tar.gz</format>
     <format>zip</format>
   </formats>
-  <includeBaseDirectory>false</includeBaseDirectory>
   <includeSiteDirectory>false</includeSiteDirectory>
-  <moduleSets>
-    <moduleSet>
-      <useAllReactorProjects>false</useAllReactorProjects>
+  <dependencySets>
+    <dependencySet>
       <includes>
         <include>org.apache.commons:commons-vfs2</include>
         <include>org.apache.commons:commons-vfs2-ant</include>
@@ -36,8 +34,9 @@ limitations under the License.
         <include>org.apache.commons:commons-vfs2-jackrabbit2</include>
         <include>org.apache.commons:commons-vfs2-bom</include>
       </includes>
-    </moduleSet>
-  </moduleSets>
+      <useProjectArtifact>false</useProjectArtifact>
+    </dependencySet>
+  </dependencySets>
   <fileSets>
     <fileSet>
       <directory>..</directory>
diff --git a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileObject.java b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileObject.java
index 92da12fe..c1dbc20c 100644
--- a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileObject.java
+++ b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileObject.java
@@ -224,12 +224,23 @@ public class WebdavFileObject extends HttpFileObject<WebdavFileSystem> {
 
     private final WebdavFileSystem fileSystem;
 
-    protected WebdavFileObject(final AbstractFileName name, final WebdavFileSystem fileSystem) {
-        super(name, fileSystem, WebdavFileSystemConfigBuilder.getInstance());
+    /**
+     * Constructs a new instance.
+     *
+     * @param fileName the file name.
+     * @param fileSystem the file system.
+     */
+    protected WebdavFileObject(final AbstractFileName fileName, final WebdavFileSystem fileSystem) {
+        super(fileName, fileSystem, WebdavFileSystemConfigBuilder.getInstance());
         this.fileSystem = fileSystem;
         builder = (WebdavFileSystemConfigBuilder) WebdavFileSystemConfigBuilder.getInstance();
     }
 
+    /**
+     * Configures the given HttpMethodBase.
+     *
+     * @param httpMethod The HttpMethodBase to configure.
+     */
     protected void configureMethod(final HttpMethodBase httpMethod) {
         httpMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, WebdavMethodRetryHandler.getInstance());
     }
diff --git a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileSystem.java b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileSystem.java
index eabef20d..ff40765c 100644
--- a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileSystem.java
+++ b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileSystem.java
@@ -27,6 +27,7 @@ import org.apache.commons.vfs2.provider.AbstractFileName;
 import org.apache.commons.vfs2.provider.DefaultURLStreamHandler;
 import org.apache.commons.vfs2.provider.GenericFileName;
 import org.apache.commons.vfs2.provider.http.HttpFileSystem;
+import org.apache.http.client.protocol.HttpClientContext;
 
 /**
  * A WebDAV file system.
@@ -35,9 +36,16 @@ import org.apache.commons.vfs2.provider.http.HttpFileSystem;
  */
 public class WebdavFileSystem extends HttpFileSystem {
 
-    protected WebdavFileSystem(final GenericFileName rootName, final HttpClient client,
+    /**
+     * Constructs a new instance.
+     *
+     * @param rootName root base name
+     * @param httpClient {@link HttpClient} instance
+     * @param fileSystemOptions Options to build this file system.
+     */
+    protected WebdavFileSystem(final GenericFileName rootName, final HttpClient httpClient,
             final FileSystemOptions fileSystemOptions) {
-        super(rootName, client, fileSystemOptions);
+        super(rootName, httpClient, fileSystemOptions);
     }
 
     /**
diff --git a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileSystem.java b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileSystem.java
index ecdffeef..e8453725 100644
--- a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileSystem.java
+++ b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileSystem.java
@@ -36,6 +36,14 @@ import org.apache.http.client.protocol.HttpClientContext;
  */
 public class Webdav4FileSystem extends Http4FileSystem {
 
+    /**
+     * Constructs a new instance.
+     *
+     * @param rootName root base name
+     * @param fileSystemOptions file system options
+     * @param httpClient {@link HttpClient} instance
+     * @param httpClientContext {@link HttpClientContext} instance
+     */
     protected Webdav4FileSystem(final FileName rootName, final FileSystemOptions fileSystemOptions,
             final HttpClient httpClient, final HttpClientContext httpClientContext) {
         super(rootName, fileSystemOptions, httpClient, httpClientContext);
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java
index 45410772..ca19c824 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java
@@ -24,7 +24,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.DurationUtils;
 
 /**
- * Abstract class which has the right to fill FileSystemOptions.
+ * Abstracts configuring {@link FileSystemOptions}s.
  */
 public abstract class FileSystemConfigBuilder {
 
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/SizeRangeFileFilter.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/SizeRangeFileFilter.java
index 18104f39..ecaf386b 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/SizeRangeFileFilter.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/SizeRangeFileFilter.java
@@ -32,7 +32,10 @@ public class SizeRangeFileFilter implements FileFilter, Serializable {
 
     private static final long serialVersionUID = 1L;
 
-    private final FileFilter filter;
+    /**
+     * File filter for min/max.
+     */
+    private final FileFilter fileFilter;
 
     /**
      * Constructor with sizes.
@@ -43,12 +46,12 @@ public class SizeRangeFileFilter implements FileFilter, Serializable {
     public SizeRangeFileFilter(final long minSizeInclusive, final long maxSizeInclusive) {
         final FileFilter minimumFilter = new SizeFileFilter(minSizeInclusive, true);
         final FileFilter maximumFilter = new SizeFileFilter(maxSizeInclusive + 1L, false);
-        filter = new AndFileFilter(minimumFilter, maximumFilter);
+        fileFilter = new AndFileFilter(minimumFilter, maximumFilter);
     }
 
     @Override
     public boolean accept(final FileSelectInfo fileSelectInfo) throws FileSystemException {
-        return filter.accept(fileSelectInfo);
+        return fileFilter.accept(fileSelectInfo);
     }
 
 }
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java
index 125ba18c..b10189cb 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java
@@ -86,9 +86,16 @@ public class HttpFileObject<FS extends HttpFileSystem> extends AbstractFileObjec
         this(name, fileSystem, HttpFileSystemConfigBuilder.getInstance());
     }
 
-    protected HttpFileObject(final AbstractFileName name, final FS fileSystem,
+    /**
+     * Constructs a new instance.
+     *
+     * @param fileName the file name.
+     * @param fileSystem the file system.
+     * @param builder Configuration options for HTTP.
+     */
+    protected HttpFileObject(final AbstractFileName fileName, final FS fileSystem,
             final HttpFileSystemConfigBuilder builder) {
-        super(name, fileSystem);
+        super(fileName, fileSystem);
         final FileSystemOptions fileSystemOptions = fileSystem.getFileSystemOptions();
         urlCharset = builder.getUrlCharset(fileSystemOptions);
         userAgent = builder.getUserAgent(fileSystemOptions);
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileSystem.java
index 0acb38e2..c59a5876 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileSystem.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileSystem.java
@@ -36,12 +36,19 @@ import org.apache.commons.vfs2.provider.GenericFileName;
 @Deprecated
 public class HttpFileSystem extends AbstractFileSystem {
 
-    private final HttpClient client;
+    private final HttpClient httpClient;
 
-    protected HttpFileSystem(final GenericFileName rootName, final HttpClient client,
+    /**
+     * Constructs a new instance.
+     *
+     * @param rootName root base name
+     * @param httpClient {@link HttpClient} instance
+     * @param fileSystemOptions Options to build this file system.
+     */
+    protected HttpFileSystem(final GenericFileName rootName, final HttpClient httpClient,
             final FileSystemOptions fileSystemOptions) {
         super(rootName, null, fileSystemOptions);
-        this.client = client;
+        this.httpClient = httpClient;
     }
 
     /**
@@ -72,6 +79,6 @@ public class HttpFileSystem extends AbstractFileSystem {
     }
 
     protected HttpClient getClient() {
-        return client;
+        return httpClient;
     }
 }
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileSystem.java
index e3b72355..b18da8c3 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileSystem.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileSystem.java
@@ -55,7 +55,7 @@ public class Http4FileSystem extends AbstractFileSystem {
     private final HttpClientContext httpClientContext;
 
     /**
-     * Constructs {@code Http4FileSystem}.
+     * Constructs a new instance.
      *
      * @param rootName root base name
      * @param fileSystemOptions file system options
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java
index c6641c19..be4539d5 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java
@@ -39,11 +39,15 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder {
      * Proxy type.
      */
     public static final class ProxyType implements Serializable, Comparable<ProxyType> {
+
         /**
          * serialVersionUID format is YYYYMMDD for the date of the last binary change.
          */
         private static final long serialVersionUID = 20101208L;
 
+        /**
+         * The proxy type.
+         */
         private final String proxyType;
 
         private ProxyType(final String proxyType) {
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystem.java
index 7eb5d8bb..2389ad61 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystem.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystem.java
@@ -123,6 +123,10 @@ public class ZipFileSystem extends AbstractFileSystem {
         }
     }
 
+    /**
+     * Gets the Charset.
+     * @return the Charset.
+     */
     protected Charset getCharset() {
         return charset;
     }
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystemConfigBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystemConfigBuilder.java
index f22eeae7..0c0b7c7f 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystemConfigBuilder.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystemConfigBuilder.java
@@ -23,6 +23,9 @@ import org.apache.commons.vfs2.FileSystem;
 import org.apache.commons.vfs2.FileSystemConfigBuilder;
 import org.apache.commons.vfs2.FileSystemOptions;
 
+/**
+ * Configures {@link FileSystemOptions}s.
+ */
 public class ZipFileSystemConfigBuilder extends FileSystemConfigBuilder {
 
     private static final String PREFIX = ZipFileSystemConfigBuilder.class.getName();


(commons-vfs) 05/06: Javadoc constructors

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 cdacc5c588b1ca033dcd65a06e6e03da8ea80c81
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Aug 11 17:35:35 2024 -0400

    Javadoc constructors
---
 .../apache/commons/vfs2/provider/smb/SmbFileObject.java   | 11 +++++++++--
 .../commons/vfs2/provider/bzip2/Bzip2FileObject.java      | 11 +++++++++--
 .../provider/compressed/CompressedFileFileObject.java     | 11 +++++++++--
 .../apache/commons/vfs2/provider/ftp/FtpFileObject.java   | 14 +++++++++++---
 .../apache/commons/vfs2/provider/gzip/GzipFileObject.java | 11 +++++++++--
 .../apache/commons/vfs2/provider/http/HttpFileObject.java | 10 ++++++++--
 .../apache/commons/vfs2/provider/jar/JarFileObject.java   | 15 ++++++++++++---
 .../apache/commons/vfs2/provider/ram/RamFileObject.java   | 10 ++++++----
 .../apache/commons/vfs2/provider/sftp/SftpFileObject.java | 13 ++++++++++---
 .../apache/commons/vfs2/provider/tar/TarFileObject.java   | 12 ++++++++++--
 .../apache/commons/vfs2/provider/url/UrlFileObject.java   | 10 ++++++++--
 .../apache/commons/vfs2/provider/zip/ZipFileObject.java   | 13 ++++++++++---
 12 files changed, 111 insertions(+), 30 deletions(-)

diff --git a/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java
index af23aa44..0b8c5c90 100644
--- a/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java
+++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java
@@ -47,8 +47,15 @@ public class SmbFileObject extends AbstractFileObject<SmbFileSystem> {
     // private final String fileName;
     private SmbFile file;
 
-    protected SmbFileObject(final AbstractFileName name, final SmbFileSystem fileSystem) throws FileSystemException {
-        super(name, fileSystem);
+    /**
+     * Constructs a new instance.
+     *
+     * @param fileName the file name.
+     * @param fileSystem the file system.
+     * @throws FileSystemException not thrown.
+     */
+    protected SmbFileObject(final AbstractFileName fileName, final SmbFileSystem fileSystem) throws FileSystemException {
+        super(fileName, fileSystem);
         // this.fileName = UriParser.decode(name.getURI());
     }
 
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/bzip2/Bzip2FileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/bzip2/Bzip2FileObject.java
index 5510634b..ea915067 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/bzip2/Bzip2FileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/bzip2/Bzip2FileObject.java
@@ -51,8 +51,15 @@ public class Bzip2FileObject extends CompressedFileFileObject<Bzip2FileSystem> {
         return new BZip2CompressorInputStream(inputStream);
     }
 
-    protected Bzip2FileObject(final AbstractFileName name, final FileObject container, final Bzip2FileSystem fs) {
-        super(name, container, fs);
+    /**
+     * Constructs a new instance.
+     *
+     * @param fileName the file name.
+     * @param container the container.
+     * @param fileSystem the file system.
+     */
+    protected Bzip2FileObject(final AbstractFileName fileName, final FileObject container, final Bzip2FileSystem fileSystem) {
+        super(fileName, container, fileSystem);
     }
 
     /**
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/compressed/CompressedFileFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/compressed/CompressedFileFileObject.java
index 9ec6026f..a5665de6 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/compressed/CompressedFileFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/compressed/CompressedFileFileObject.java
@@ -43,8 +43,15 @@ public abstract class CompressedFileFileObject<FS extends CompressedFileFileSyst
     private final FileObject container;
     private final String[] children;
 
-    protected CompressedFileFileObject(final AbstractFileName name, final FileObject container, final FS fs) {
-        super(name, fs);
+    /**
+     * Constructs a new instance.
+     *
+     * @param fileName the file name.
+     * @param container the container.
+     * @param fileSystem the file system.
+     */
+    protected CompressedFileFileObject(final AbstractFileName fileName, final FileObject container, final FS fileSystem) {
+        super(fileName, fileSystem);
         this.container = container;
 
         // TODO, add getBaseName(String) to FileName
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java
index 2b2d2896..e04e6df7 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java
@@ -146,10 +146,18 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> {
 
     private final AtomicBoolean inRefresh = new AtomicBoolean();
 
-    protected FtpFileObject(final AbstractFileName name, final FtpFileSystem fileSystem, final FileName rootName)
+    /**
+     * Constructs a new instance.
+     *
+     * @param fileName the file name.
+     * @param fileSystem the file system.
+     * @param rootName the root name.
+     * @throws FileSystemException if an file system error occurs.
+     */
+    protected FtpFileObject(final AbstractFileName fileName, final FtpFileSystem fileSystem, final FileName rootName)
             throws FileSystemException {
-        super(name, fileSystem);
-        final String relPath = UriParser.decode(rootName.getRelativeName(name));
+        super(fileName, fileSystem);
+        final String relPath = UriParser.decode(rootName.getRelativeName(fileName));
         if (".".equals(relPath)) {
             // do not use the "." as path against the ftp-server
             // e.g. the uu.net ftp-server do a recursive listing then
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/gzip/GzipFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/gzip/GzipFileObject.java
index 6d184e68..af620717 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/gzip/GzipFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/gzip/GzipFileObject.java
@@ -53,8 +53,15 @@ public class GzipFileObject extends CompressedFileFileObject<GzipFileSystem> {
         super(name, container, cast(fs));
     }
 
-    protected GzipFileObject(final AbstractFileName name, final FileObject container, final GzipFileSystem fs) {
-        super(name, container, fs);
+    /**
+     * Constructs a new instance.
+     *
+     * @param fileName the file name.
+     * @param container the container.
+     * @param fileSystem the file system.
+     */
+    protected GzipFileObject(final AbstractFileName fileName, final FileObject container, final GzipFileSystem fileSystem) {
+        super(fileName, container, fileSystem);
     }
 
     @Override
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java
index b10189cb..f4c192bd 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java
@@ -82,8 +82,14 @@ public class HttpFileObject<FS extends HttpFileSystem> extends AbstractFileObjec
     private final boolean followRedirect;
     private HeadMethod method;
 
-    protected HttpFileObject(final AbstractFileName name, final FS fileSystem) {
-        this(name, fileSystem, HttpFileSystemConfigBuilder.getInstance());
+    /**
+     * Constructs a new instance.
+     *
+     * @param fileName the file name.
+     * @param fileSystem the file system.
+     */
+    protected HttpFileObject(final AbstractFileName fileName, final FS fileSystem) {
+        this(fileName, fileSystem, HttpFileSystemConfigBuilder.getInstance());
     }
 
     /**
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/jar/JarFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/jar/JarFileObject.java
index c189ee05..cbf40ee1 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/jar/JarFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/jar/JarFileObject.java
@@ -39,16 +39,25 @@ public class JarFileObject extends ZipFileObject {
 
     private Attributes attributes;
 
-    protected JarFileObject(final AbstractFileName name, final ZipEntry entry, final JarFileSystem fs,
+    /**
+     * Constructs a new instance.
+     *
+     * @param fileName the file name.
+     * @param entry the zip entry.
+     * @param fileSystem the file system.
+     * @param zipExists Whether the zip file exists.
+     * @throws FileSystemException if a file system error occurs.
+     */
+    protected JarFileObject(final AbstractFileName fileName, final ZipEntry entry, final JarFileSystem fileSystem,
         final boolean zipExists) throws FileSystemException {
-        super(name, entry, fs, zipExists);
+        super(fileName, entry, fileSystem, zipExists);
         if (entry != null) {
             // For Java 9 and up: Force the certificates to be read and cached now. This avoids an
             // IllegalStateException in java.util.jar.JarFile.isMultiRelease() when it tries
             // to read the certificates and the file is closed.
             ((JarEntry) entry).getCertificates();
         }
-        this.fs = fs;
+        this.fs = fileSystem;
 
         try {
             getAttributes(); // early get the attributes as the zip file might be closed
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java
index 153a6814..e0a67fdb 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java
@@ -44,11 +44,13 @@ public class RamFileObject extends AbstractFileObject<RamFileSystem> {
     private RamFileData data;
 
     /**
-     * @param name The name of the file.
-     * @param fs The FileSystem.
+     * Constructs a new instance.
+     *
+     * @param fileName the file name.
+     * @param fileSystem the file system.
      */
-    protected RamFileObject(final AbstractFileName name, final RamFileSystem fs) {
-        super(name, fs);
+    protected RamFileObject(final AbstractFileName fileName, final RamFileSystem fileSystem) {
+        super(fileName, fileSystem);
         getAbstractFileSystem().attach(this);
     }
 
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java
index 16f19e93..49e0e783 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java
@@ -99,9 +99,16 @@ public class SftpFileObject extends AbstractFileObject<SftpFileSystem> {
 
     private final String relPath;
 
-    protected SftpFileObject(final AbstractFileName name, final SftpFileSystem fileSystem) throws FileSystemException {
-        super(name, fileSystem);
-        relPath = UriParser.decode(fileSystem.getRootName().getRelativeName(name));
+    /**
+     * Constructs a new instance.
+     *
+     * @param fileName the file name.
+     * @param fileSystem the file system.
+     * @throws FileSystemException if a file system error occurs.
+     */
+    protected SftpFileObject(final AbstractFileName fileName, final SftpFileSystem fileSystem) throws FileSystemException {
+        super(fileName, fileSystem);
+        relPath = UriParser.decode(fileSystem.getRootName().getRelativeName(fileName));
     }
 
     /**
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileObject.java
index dc6d3226..4c29ed11 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileObject.java
@@ -38,9 +38,17 @@ public class TarFileObject extends AbstractFileObject<TarFileSystem> {
     private final HashSet<String> children = new HashSet<>();
     private FileType type;
 
-    protected TarFileObject(final AbstractFileName name, final TarArchiveEntry entry, final TarFileSystem fs,
+    /**
+     * Constructs a new instance.
+     *
+     * @param fileName the file name.
+     * @param entry the archive entry.
+     * @param fileSystem the file system.
+     * @param tarExists whether the tar file exists.
+     */
+    protected TarFileObject(final AbstractFileName fileName, final TarArchiveEntry entry, final TarFileSystem fileSystem,
             final boolean tarExists) {
-        super(name, fs);
+        super(fileName, fileSystem);
         setTarEntry(entry);
         if (!tarExists) {
             type = FileType.IMAGINARY;
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileObject.java
index df09a5b8..fe571539 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileObject.java
@@ -43,8 +43,14 @@ import org.apache.commons.vfs2.provider.URLFileName;
 public class UrlFileObject extends AbstractFileObject<UrlFileSystem> {
     private URL url;
 
-    protected UrlFileObject(final UrlFileSystem fs, final AbstractFileName fileName) {
-        super(fileName, fs);
+    /**
+     * Constructs a new instance.
+     *
+     * @param fileSystem the file system.
+     * @param fileName the file name.
+     */
+    protected UrlFileObject(final UrlFileSystem fileSystem, final AbstractFileName fileName) {
+        super(fileName, fileSystem);
     }
 
     protected URL createURL(final FileName name) throws MalformedURLException, FileSystemException, URIException {
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileObject.java
index cebf38b9..1e121836 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileObject.java
@@ -38,9 +38,16 @@ public class ZipFileObject extends AbstractFileObject<ZipFileSystem> {
     private final HashSet<String> children = new HashSet<>();
     private FileType type;
 
-    protected ZipFileObject(final AbstractFileName name, final ZipEntry entry, final ZipFileSystem fs,
-            final boolean zipExists) {
-        super(name, fs);
+    /**
+     * Constructs a new instance.
+     *
+     * @param fileName the file name.
+     * @param entry The zip entry.
+     * @param fileSystem the file system.
+     * @param zipExists whether the zip file exists.
+     */
+    protected ZipFileObject(final AbstractFileName fileName, final ZipEntry entry, final ZipFileSystem fileSystem, final boolean zipExists) {
+        super(fileName, fileSystem);
         setZipEntry(entry);
         if (!zipExists) {
             type = FileType.IMAGINARY;


(commons-vfs) 06/06: Javadoc

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 243ed5b08cf8c10abc259643b8e84348dd23f4bd
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Aug 12 07:11:46 2024 -0400

    Javadoc
---
 .../org/apache/commons/vfs2/provider/smb/SmbFileName.java   | 13 +++++++++++++
 .../org/apache/commons/vfs2/provider/GenericFileName.java   | 12 ++++++++++++
 .../apache/commons/vfs2/provider/local/LocalFileName.java   |  8 ++++++++
 .../apache/commons/vfs2/provider/local/WindowsFileName.java |  8 ++++++++
 .../apache/commons/vfs2/provider/res/ResourceFileName.java  |  7 +++++++
 .../org/apache/commons/vfs2/provider/tar/TarFileSystem.java | 12 +++++++++++-
 .../org/apache/commons/vfs2/provider/url/UrlFileObject.java | 12 +++++++++---
 .../org/apache/commons/vfs2/provider/url/UrlFileSystem.java |  6 ++++++
 .../org/apache/commons/vfs2/util/WeakRefFileListener.java   |  6 ++++++
 9 files changed, 80 insertions(+), 4 deletions(-)

diff --git a/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java
index 38ceee9d..eb7a4582 100644
--- a/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java
+++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java
@@ -31,6 +31,19 @@ public class SmbFileName extends GenericFileName {
     private final String domain;
     private String uriWithoutAuth;
 
+    /**
+     * Constructs a new instance.
+     *
+     * @param scheme the scheme.
+     * @param hostName the host name.
+     * @param port the port.
+     * @param userName the user name.
+     * @param password the password.
+     * @param domain the domain.
+     * @param share the share.
+     * @param path the absolute path, maybe empty or null.
+     * @param type the file type.
+     */
     protected SmbFileName(final String scheme, final String hostName, final int port, final String userName,
             final String password, final String domain, final String share, final String path, final FileType type) {
         super(scheme, hostName, port, DEFAULT_PORT, userName, password, path, type);
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/GenericFileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/GenericFileName.java
index 12a5ebe6..5321e1df 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/GenericFileName.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/GenericFileName.java
@@ -32,6 +32,18 @@ public class GenericFileName extends AbstractFileName {
     private final String password;
     private final int port;
 
+    /**
+     * Constructs a new instance.
+     *
+     * @param scheme the scheme.
+     * @param hostName the host name.
+     * @param port the port.
+     * @param defaultPort the default port.
+     * @param userName the user name.
+     * @param password the password.
+     * @param path the absolute path, maybe empty or null.
+     * @param type the file type.
+     */
     protected GenericFileName(final String scheme, final String hostName, final int port, final int defaultPort,
         final String userName, final String password, final String path, final FileType type) {
         super(scheme, path, type);
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFileName.java
index ff86c025..d85b9e90 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFileName.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFileName.java
@@ -29,6 +29,14 @@ public class LocalFileName extends AbstractFileName {
 
     private final String rootFile;
 
+    /**
+     * Constructs a new instance.
+     *
+     * @param scheme the scheme.
+     * @param rootFile the root file.
+     * @param path the absolute path, maybe empty or null.
+     * @param type the file type.
+     */
     protected LocalFileName(final String scheme, final String rootFile, final String path, final FileType type) {
         super(scheme, path, type);
         this.rootFile = rootFile;
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/WindowsFileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/WindowsFileName.java
index e56f4ab2..663257a2 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/WindowsFileName.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/WindowsFileName.java
@@ -24,6 +24,14 @@ import org.apache.commons.vfs2.FileType;
  */
 public class WindowsFileName extends LocalFileName {
 
+    /**
+     * Constructs a new instance.
+     *
+     * @param scheme the scheme.
+     * @param rootFile the root file.
+     * @param path the absolute path, maybe empty or null.
+     * @param type the file type.
+     */
     protected WindowsFileName(final String scheme, final String rootFile, final String path, final FileType type) {
         super(scheme, rootFile, path, type);
     }
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/res/ResourceFileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/res/ResourceFileName.java
index 80b982fc..495d3e79 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/res/ResourceFileName.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/res/ResourceFileName.java
@@ -27,6 +27,13 @@ import org.apache.commons.vfs2.provider.UriParser;
  */
 public class ResourceFileName extends AbstractFileName {
 
+    /**
+     * Constructs a new instance.
+     *
+     * @param scheme The scheme.
+     * @param path the absolute path, maybe empty or null.
+     * @param type the file type.
+     */
     protected ResourceFileName(final String scheme, final String path, final FileType type) {
         super(scheme, path, type);
     }
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java
index 0feb5530..554fa982 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java
@@ -158,6 +158,12 @@ public class TarFileSystem extends AbstractFileSystem {
         }
     }
 
+    /**
+     * Gets the TarArchiveInputStream.
+     *
+     * @return the TarArchiveInputStream.
+     * @throws FileSystemException if a file system error occurs.
+     */
     protected TarArchiveInputStream getTarFile() throws FileSystemException {
         if (tarFile == null && file.exists()) {
             recreateTarFile();
@@ -223,7 +229,6 @@ public class TarFileSystem extends AbstractFileSystem {
      * will be called after all file-objects closed their streams. protected void notifyAllStreamsClosed() {
      * closeCommunicationLink(); }
      */
-
     private void recreateTarFile() throws FileSystemException {
         if (tarFile != null) {
             try {
@@ -244,6 +249,11 @@ public class TarFileSystem extends AbstractFileSystem {
         cache.remove(name);
     }
 
+    /**
+     * Resets the tar file.
+     *
+     * @throws FileSystemException if a file system error occurs.
+     */
     protected void resetTarFile() throws FileSystemException {
         // Reading specific entries requires skipping through the tar file from the beginning
         // Not especially elegant, but we don't have the ability to seek to specific positions
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileObject.java
index fe571539..13ef8f0f 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileObject.java
@@ -17,13 +17,12 @@
 package org.apache.commons.vfs2.provider.url;
 
 import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.io.InputStream;
 import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLConnection;
 
-import org.apache.commons.httpclient.URIException;
 import org.apache.commons.vfs2.FileName;
 import org.apache.commons.vfs2.FileSystemException;
 import org.apache.commons.vfs2.FileType;
@@ -53,7 +52,14 @@ public class UrlFileObject extends AbstractFileObject<UrlFileSystem> {
         super(fileName, fileSystem);
     }
 
-    protected URL createURL(final FileName name) throws MalformedURLException, FileSystemException, URIException {
+    /**
+     * Creates a URL from the given file name.
+     *
+     * @param name the file name.
+     * @return a new URL.
+     * @throws IOException if an I/O error occurs.
+     */
+    protected URL createURL(final FileName name) throws IOException {
         if (name instanceof URLFileName) {
             final URLFileName urlName = (URLFileName) getName();
 
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileSystem.java
index 2f26693a..ea662214 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileSystem.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileSystem.java
@@ -30,6 +30,12 @@ import org.apache.commons.vfs2.provider.AbstractFileSystem;
  */
 public class UrlFileSystem extends AbstractFileSystem {
 
+    /**
+     * Constructs a new instance.
+     *
+     * @param rootName The root file name of this file system.
+     * @param fileSystemOptions Options to build this file system.
+     */
     protected UrlFileSystem(final FileName rootName, final FileSystemOptions fileSystemOptions) {
         super(rootName, null, fileSystemOptions);
     }
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/WeakRefFileListener.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/WeakRefFileListener.java
index 09c71d51..ba9cf2cb 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/WeakRefFileListener.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/WeakRefFileListener.java
@@ -57,6 +57,12 @@ public class WeakRefFileListener implements FileListener {
 
     private final WeakReference<FileListener> listener;
 
+    /**
+     * Constructs a new instance.
+     *
+     * @param file the file object.
+     * @param listener the file listener.
+     */
     protected WeakRefFileListener(final FileObject file, final FileListener listener) {
         fs = file.getFileSystem();
         name = file.getName();


(commons-vfs) 04/06: Add FileSystemConfigBuilder.getParamOrDefault(FileSystemOptions, String, T)

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 654bcf1110f7da2275a293ed6299b1ca19aa3397
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Aug 11 17:24:36 2024 -0400

    Add FileSystemConfigBuilder.getParamOrDefault(FileSystemOptions, String,
    T)
    
    - ZipFileSystemConfigBuilder.getCharset(FileSystemOptions) returns UTF-8
    instead of null when absent
---
 .../commons/vfs2/provider/webdav/WebdavFileSystem.java    |  1 -
 .../org/apache/commons/vfs2/FileSystemConfigBuilder.java  | 15 +++++++++++++++
 .../java/org/apache/commons/vfs2/FileSystemOptions.java   |  7 ++++++-
 .../apache/commons/vfs2/provider/zip/ZipFileSystem.java   |  9 +++++----
 .../vfs2/provider/zip/ZipFileSystemConfigBuilder.java     |  5 +++--
 .../provider/zip/ZipProviderWithCharsetNullTestCase.java  |  3 ++-
 src/changes/changes.xml                                   |  6 ++++++
 7 files changed, 37 insertions(+), 9 deletions(-)

diff --git a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileSystem.java b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileSystem.java
index ff40765c..1709fb66 100644
--- a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileSystem.java
+++ b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileSystem.java
@@ -27,7 +27,6 @@ import org.apache.commons.vfs2.provider.AbstractFileName;
 import org.apache.commons.vfs2.provider.DefaultURLStreamHandler;
 import org.apache.commons.vfs2.provider.GenericFileName;
 import org.apache.commons.vfs2.provider.http.HttpFileSystem;
-import org.apache.http.client.protocol.HttpClientContext;
 
 /**
  * A WebDAV file system.
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java
index ca19c824..4a39aef4 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java
@@ -508,6 +508,21 @@ public abstract class FileSystemConfigBuilder {
         return fileSystemOptions == null ? null : fileSystemOptions.getOption(getConfigClass(), name);
     }
 
+    /**
+     * Gets a named parameter.
+     *
+     * @param <T> The expected return type.
+     * @param fileSystemOptions file system options to query, may be null.
+     * @param name get option with this name
+     * @param defaultValue The default value if absent.
+     * @return the named option or {@code defaultValue}.
+     *
+     * @since 2.10.0
+     */
+    protected <T> T getParamOrDefault(final FileSystemOptions fileSystemOptions, final String name, final T defaultValue) {
+        return fileSystemOptions == null ? defaultValue : fileSystemOptions.getOptionOrDefault(getConfigClass(), name, defaultValue);
+    }
+
     /**
      * Gets a named parameter.
      *
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
index 958f52b5..f4dd9fa6 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
@@ -192,7 +192,12 @@ public final class FileSystemOptions implements Cloneable, Comparable<FileSystem
     }
 
     <T> T getOption(final Class<? extends FileSystem> fileSystemClass, final String name) {
-        return (T) options.get(new FileSystemOptionKey(fileSystemClass, name));
+        return getOptionOrDefault(fileSystemClass, name, null);
+    }
+
+    <T> T getOptionOrDefault(final Class<? extends FileSystem> fileSystemClass, final String name, final T defaultValue) {
+        final T value = (T) options.getOrDefault(new FileSystemOptionKey(fileSystemClass, name), defaultValue);
+        return value != null ? value : defaultValue;
     }
 
     @Override
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystem.java
index 2389ad61..b8a8990c 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystem.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystem.java
@@ -19,6 +19,7 @@ package org.apache.commons.vfs2.provider.zip;
 import java.io.File;
 import java.io.IOException;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.Collection;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -98,14 +99,13 @@ public class ZipFileSystem extends AbstractFileSystem {
 
     protected ZipFile createZipFile(final File file) throws FileSystemException {
         try {
-            return charset == null ? new ZipFile(file) : new ZipFile(file, charset);
+            return new ZipFile(file, charset);
         } catch (final IOException ioe) {
             throw new FileSystemException("vfs.provider.zip/open-zip-file.error", file, ioe);
         }
     }
 
-    protected ZipFileObject createZipFileObject(final AbstractFileName name, final ZipEntry entry)
-            throws FileSystemException {
+    protected ZipFileObject createZipFileObject(final AbstractFileName name, final ZipEntry entry) throws FileSystemException {
         return new ZipFileObject(name, entry, this, true);
     }
 
@@ -124,7 +124,8 @@ public class ZipFileSystem extends AbstractFileSystem {
     }
 
     /**
-     * Gets the Charset.
+     * Gets the Charset, defaults to {@link StandardCharsets#UTF_8}, the value used in {@link ZipFile}.
+     *
      * @return the Charset.
      */
     protected Charset getCharset() {
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystemConfigBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystemConfigBuilder.java
index 0c0b7c7f..eaa50169 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystemConfigBuilder.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileSystemConfigBuilder.java
@@ -18,6 +18,7 @@
 package org.apache.commons.vfs2.provider.zip;
 
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.commons.vfs2.FileSystem;
 import org.apache.commons.vfs2.FileSystemConfigBuilder;
@@ -49,13 +50,13 @@ public class ZipFileSystemConfigBuilder extends FileSystemConfigBuilder {
     }
 
     /**
-     * Gets the Charset from the FileSystemOptions.
+     * Gets the Charset from the FileSystemOptions or {@link StandardCharsets#UTF_8} if absent.
      *
      * @param fileSystemOptions The source FileSystemOptions.
      * @return the Charset from the FileSystemOptions.
      */
     public Charset getCharset(final FileSystemOptions fileSystemOptions) {
-        return getParam(fileSystemOptions, KEY_CHARSET);
+        return getParamOrDefault(fileSystemOptions, KEY_CHARSET, StandardCharsets.UTF_8);
     }
 
     @Override
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipProviderWithCharsetNullTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipProviderWithCharsetNullTestCase.java
index 9f84fdef..e504d409 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipProviderWithCharsetNullTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/ZipProviderWithCharsetNullTestCase.java
@@ -19,6 +19,7 @@ package org.apache.commons.vfs2.provider.zip;
 import static org.apache.commons.vfs2.VfsTestUtils.getTestResource;
 
 import java.io.File;
+import java.nio.charset.StandardCharsets;
 
 import junit.framework.Test;
 
@@ -59,7 +60,7 @@ public class ZipProviderWithCharsetNullTestCase extends AbstractProviderTestConf
         final FileSystem fileSystem = resolvedFile.getFileSystem();
         Assertions.assertTrue(fileSystem instanceof ZipFileSystem);
         final ZipFileSystem zipFileSystem = (ZipFileSystem) fileSystem;
-        Assertions.assertNull(zipFileSystem.getCharset());
+        Assertions.assertEquals(StandardCharsets.UTF_8, zipFileSystem.getCharset());
         return resolvedFile;
     }
 
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index c0ff7eb4..7ec1e0f9 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -200,6 +200,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Arnout Engelen">
         Simplify UriParser #558.
       </action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">
+        ZipFileSystemConfigBuilder.getCharset(FileSystemOptions) returns UTF-8 instead of null when absent.
+      </action>
       <!-- ADD -->
       <action type="add" issue="VFS-848" dev="ggregory" due-to="beise, Gary Gregory">
         Config option for trailing slash in webdav URI #425.
@@ -252,6 +255,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="add" dev="ggregory" due-to="Gary Gregory">
         Add a BOM POM commons-vfs2-bom.
       </action>
+      <action type="add" dev="ggregory" due-to="Gary Gregory">
+        Add FileSystemConfigBuilder.getParamOrDefault(FileSystemOptions, String, T).
+      </action>
       <!-- UPDATE -->
       <action type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">
         Bump actions/cache and others.


(commons-vfs) 01/06: Better 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 123416b931147d93001167bdd8d53b5fe70fd6ec
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Aug 11 09:29:50 2024 -0400

    Better comment
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 601ac6a1..87ef3104 100644
--- a/pom.xml
+++ b/pom.xml
@@ -637,7 +637,7 @@
           <plugin>
             <artifactId>maven-assembly-plugin</artifactId>
             <executions>
-              <!-- Don't build the archives here. They are constructed in the dist project -->
+              <!-- Don't build the archives here. They are constructed in the distribution project -->
               <execution>
                 <configuration>
                   <skipAssembly>true</skipAssembly>


(commons-vfs) 02/06: Better 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 6e976b8149ef0a12fabb6dde1befd83e578e0a36
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Aug 11 09:39:41 2024 -0400

    Better comment
---
 commons-vfs2-distribution/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commons-vfs2-distribution/pom.xml b/commons-vfs2-distribution/pom.xml
index 76e48da3..501f29f1 100644
--- a/commons-vfs2-distribution/pom.xml
+++ b/commons-vfs2-distribution/pom.xml
@@ -33,7 +33,7 @@ limitations under the License.
   </parent>
 
   <properties>
-    <!--  dist module contains no code and no checkstyle config -->
+    <!--  distribution module contains no code and no checkstyle config -->
     <checkstyle.skip>true</checkstyle.skip>
     <commons.parent.dir>${basedir}/..</commons.parent.dir>
     <commons.release.isDistModule>true</commons.release.isDistModule>