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 2020/09/15 14:04:25 UTC
[commons-vfs] branch master updated: Javadoc; better param names;
inline local var; user ternary expression; 120 line max.
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 ef0b636 Javadoc; better param names; inline local var; user ternary expression; 120 line max.
ef0b636 is described below
commit ef0b63612b441cc67b97157374e62767356c9815
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Sep 15 10:04:17 2020 -0400
Javadoc; better param names; inline local var; user ternary expression;
120 line max.
---
.../commons/vfs2/provider/AbstractFileProvider.java | 13 ++++++-------
.../commons/vfs2/provider/CompositeFileProvider.java | 3 +--
.../org/apache/commons/vfs2/provider/FileSystemKey.java | 16 +++++++---------
3 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileProvider.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileProvider.java
index f76646d..6fabea9 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileProvider.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileProvider.java
@@ -64,7 +64,6 @@ public abstract class AbstractFileProvider extends AbstractVfsContainer implemen
synchronized (fileSystems) {
fileSystems.clear();
}
-
super.close();
}
@@ -73,13 +72,13 @@ public abstract class AbstractFileProvider extends AbstractVfsContainer implemen
*
* @param scheme The protocol to use to access the file.
* @param file a FileObject.
- * @param properties Options to the file system.
+ * @param fileSystemOptions Options to the file system.
* @return A FileObject associated with the new FileSystem.
* @throws FileSystemException if an error occurs.
*/
@Override
- public FileObject createFileSystem(final String scheme, final FileObject file, final FileSystemOptions properties)
- throws FileSystemException {
+ public FileObject createFileSystem(final String scheme, final FileObject file,
+ final FileSystemOptions fileSystemOptions) throws FileSystemException {
// Can't create a layered file system
throw new FileSystemException("vfs.provider/not-layered-fs.error", scheme);
}
@@ -110,11 +109,11 @@ public abstract class AbstractFileProvider extends AbstractVfsContainer implemen
* Locates a cached file system.
*
* @param key The root file of the file system, part of the cache key.
- * @param fileSystemProps file system options the file system instance must have.
+ * @param fileSystemOptions file system options the file system instance must have.
* @return The file system instance, or null if it is not cached.
*/
- protected FileSystem findFileSystem(final Comparable<?> key, final FileSystemOptions fileSystemProps) {
- final FileSystemKey treeKey = new FileSystemKey(key, fileSystemProps);
+ protected FileSystem findFileSystem(final Comparable<?> key, final FileSystemOptions fileSystemOptions) {
+ final FileSystemKey treeKey = new FileSystemKey(key, fileSystemOptions);
synchronized (fileSystems) {
return fileSystems.get(treeKey);
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/CompositeFileProvider.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/CompositeFileProvider.java
index 50425e5..e40350d 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/CompositeFileProvider.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/CompositeFileProvider.java
@@ -57,7 +57,6 @@ public abstract class CompositeFileProvider extends AbstractFileProvider {
UriParser.extractScheme(getContext().getFileSystemManager().getSchemes(), uri, buf);
Arrays.stream(getSchemes()).forEach(scheme -> buf.insert(0, scheme + ":"));
- final FileObject fo = getContext().getFileSystemManager().resolveFile(buf.toString(), fileSystemOptions);
- return fo;
+ return getContext().getFileSystemManager().resolveFile(buf.toString(), fileSystemOptions);
}
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/FileSystemKey.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/FileSystemKey.java
index 063aacf..b2904d4 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/FileSystemKey.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/FileSystemKey.java
@@ -19,28 +19,26 @@ package org.apache.commons.vfs2.provider;
import org.apache.commons.vfs2.FileSystemOptions;
/**
- * Used to identify a file system
+ * Identifies a file system.
*/
class FileSystemKey implements Comparable<FileSystemKey> {
private static final FileSystemOptions EMPTY_OPTIONS = new FileSystemOptions();
private final Comparable<?> key;
+
+ /** Never null as the ctor sets it to EMPTY_OPTIONS if input is null. */
private final FileSystemOptions fileSystemOptions;
/**
- * Create the FS key.
+ * Creates the FS key.
*
- * @param key must implement Comparable, and must be self-comparable
- * @param fileSystemOptions the required options
+ * @param key must implement Comparable, and must be self-comparable.
+ * @param fileSystemOptions the required options, may be null.
*/
FileSystemKey(final Comparable<?> key, final FileSystemOptions fileSystemOptions) {
this.key = key;
- if (fileSystemOptions != null) {
- this.fileSystemOptions = fileSystemOptions;
- } else {
- this.fileSystemOptions = EMPTY_OPTIONS;
- }
+ this.fileSystemOptions = fileSystemOptions != null ? fileSystemOptions : EMPTY_OPTIONS;
}
@Override