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 03c1408  Add 
org.apache.commons.vfs2.provider.AbstractFileSystem.AbstractFileSystem() for 
Serializable subclasses (PMD).
03c1408 is described below

commit 03c140893e7aa6ab4a03b7417c6dc516fac5cfda
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Wed Mar 3 09:03:22 2021 -0500

    Add org.apache.commons.vfs2.provider.AbstractFileSystem.AbstractFileSystem()
    for Serializable subclasses (PMD).
---
 .../apache/commons/vfs2/provider/AbstractFileSystem.java    | 13 +++++++++----
 src/changes/changes.xml                                     |  3 +++
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
index 7d3ac9e..4b7ef76 100644
--- 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
+++ 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
@@ -55,6 +55,11 @@ import org.apache.commons.vfs2.util.Messages;
  */
 public abstract class AbstractFileSystem extends AbstractVfsComponent 
implements FileSystem {
 
+    /** Only provided for Serializable subclasses. */
+    AbstractFileSystem() {
+        this(null, null, null);
+    }
+
     private static final FileListener[] EMPTY_FILE_LISTENER_ARRAY = new 
FileListener[0];
 
     private static final Log LOG = LogFactory.getLog(AbstractFileSystem.class);
@@ -96,15 +101,15 @@ public abstract class AbstractFileSystem extends 
AbstractVfsComponent implements
      */
     private final AtomicInteger openStreams = new AtomicInteger(0);
 
-    protected AbstractFileSystem(final FileName rootName, final FileObject 
parentLayer,
-            final FileSystemOptions fileSystemOptions) {
+    protected AbstractFileSystem(final FileName rootFileName, final FileObject 
parentLayer,
+        final FileSystemOptions fileSystemOptions) {
         this.parentLayer = parentLayer;
-        this.rootName = rootName;
+        this.rootName = rootFileName;
         this.fileSystemOptions = fileSystemOptions;
         final FileSystemConfigBuilder builder = 
DefaultFileSystemConfigBuilder.getInstance();
         String uri = builder.getRootURI(fileSystemOptions);
         if (uri == null) {
-            uri = rootName.getURI();
+            uri = rootFileName != null ? rootFileName.getURI() : null;
         }
         this.rootURI = uri;
     }
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 50ab424..c6f7c10 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -163,6 +163,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action dev="ggregory" due-to="Gary Gregory" type="add">
         [HTTP5] Add 
Http5FileSystemConfigBuilder.getSoTimeoutDuration(FileSystemOptions) and 
deprecate Integer version.
       </action>
+      <action dev="ggregory" due-to="PMD, Gary Gregory" type="add">
+        Add AbstractFileSystem.AbstractFileSystem() for Serializable 
subclasses (PMD).
+      </action>
       <!-- UPDATES -->
       <action dev="ggregory" due-to="PeterAlfredLee" type="update">
         Modify some code use for-each loop and stream API #142.

Reply via email to