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 2025/01/31 16:38:52 UTC
(commons-vfs) 06/07: Javadoc
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 ef73f2e6916fc341888bb07f6e405595a9d23f7d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jan 31 11:34:42 2025 -0500
Javadoc
- Reduce whitespace
- Inline some fluent calls
---
.../commons/vfs2/provider/AbstractOriginatingFileProvider.java | 7 ++-----
.../org/apache/commons/vfs2/provider/ftp/FtpFileProvider.java | 4 ++--
.../org/apache/commons/vfs2/provider/ftps/FtpsFileProvider.java | 2 ++
.../org/apache/commons/vfs2/provider/http/HttpFileProvider.java | 6 ++----
.../apache/commons/vfs2/provider/http4/Http4FileProvider.java | 3 ---
.../apache/commons/vfs2/provider/http5/Http5FileProvider.java | 3 ---
.../commons/vfs2/provider/local/DefaultLocalFileProvider.java | 9 ++++-----
7 files changed, 12 insertions(+), 22 deletions(-)
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractOriginatingFileProvider.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractOriginatingFileProvider.java
index 78a7c6bed..c1148cbf7 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractOriginatingFileProvider.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractOriginatingFileProvider.java
@@ -39,7 +39,7 @@ public abstract class AbstractOriginatingFileProvider extends AbstractFileProvid
*
* @param rootFileName The name of the root file of the file system to create.
* @param fileSystemOptions The FileSystem options.
- * @return The FileSystem.
+ * @return The FileSystem, never null.
* @throws FileSystemException if an error occurs.
*/
protected abstract FileSystem doCreateFileSystem(FileName rootFileName, FileSystemOptions fileSystemOptions) throws FileSystemException;
@@ -56,11 +56,8 @@ public abstract class AbstractOriginatingFileProvider extends AbstractFileProvid
throws FileSystemException {
// Check in the cache for the file system
final FileName rootName = getContext().getFileSystemManager().resolveName(fileName, FileName.ROOT_PATH);
-
- final FileSystem fs = getFileSystem(rootName, fileSystemOptions);
-
// Locate the file
- // return fs.resolveFile(name.getPath());
+ final FileSystem fs = getFileSystem(rootName, fileSystemOptions);
return fs.resolveFile(fileName);
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileProvider.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileProvider.java
index 6b6d4f020..f578cebbe 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileProvider.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileProvider.java
@@ -60,19 +60,19 @@ public class FtpFileProvider extends AbstractOriginatingFileProvider {
/**
* Creates the file system.
+ *
+ * @return a new FileSystem, never null.
*/
@Override
protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions)
throws FileSystemException {
// Create the file system
final GenericFileName rootName = (GenericFileName) name;
-
final FTPClientWrapper ftpClient = new FTPClientWrapper(rootName, fileSystemOptions);
/*
* FTPClient ftpClient = FtpClientFactory.createConnection(rootName.getHostName(), rootName.getPort(),
* rootName.getUserName(), rootName.getPassword(), rootName.getPath(), fileSystemOptions);
*/
-
return new FtpFileSystem(rootName, ftpClient, fileSystemOptions);
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileProvider.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileProvider.java
index 4c85e7770..203ec2fad 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileProvider.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileProvider.java
@@ -42,6 +42,8 @@ public class FtpsFileProvider extends FtpFileProvider {
/**
* Creates the file system.
+ *
+ * @return a new FileSystem, never null.
*/
@Override
protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions)
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileProvider.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileProvider.java
index 9a54f6cd4..70d659df4 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileProvider.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileProvider.java
@@ -57,22 +57,21 @@ public class HttpFileProvider extends AbstractOriginatingFileProvider {
/**
* Creates a {@link FileSystem}.
+ *
+ * @return a new FileSystem, never null.
*/
@Override
protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions)
throws FileSystemException {
// Create the file system
final GenericFileName rootName = (GenericFileName) name;
-
UserAuthenticationData authData = null;
HttpClient httpClient;
try {
authData = UserAuthenticatorUtils.authenticate(fileSystemOptions, AUTHENTICATOR_TYPES);
-
final String fileScheme = rootName.getScheme();
final char lastChar = fileScheme.charAt(fileScheme.length() - 1);
final String internalScheme = lastChar == 's' || lastChar == 'S' ? "https" : "http";
-
httpClient = HttpClientFactory.createConnection(internalScheme, rootName.getHostName(),
rootName.getPort(),
UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData,
@@ -83,7 +82,6 @@ public class HttpFileProvider extends AbstractOriginatingFileProvider {
} finally {
UserAuthenticatorUtils.cleanup(authData);
}
-
return new HttpFileSystem(rootName, httpClient, fileSystemOptions);
}
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 b72d181b8..58245dced 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
@@ -340,11 +340,9 @@ public class Http4FileProvider extends AbstractOriginatingFileProvider {
protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions)
throws FileSystemException {
final GenericFileName rootName = (GenericFileName) name;
-
UserAuthenticationData authData = null;
HttpClient httpClient;
HttpClientContext httpClientContext;
-
try {
final Http4FileSystemConfigBuilder builder = Http4FileSystemConfigBuilder.getInstance();
authData = UserAuthenticatorUtils.authenticate(fileSystemOptions, AUTHENTICATOR_TYPES);
@@ -353,7 +351,6 @@ public class Http4FileProvider extends AbstractOriginatingFileProvider {
} finally {
UserAuthenticatorUtils.cleanup(authData);
}
-
return new Http4FileSystem(rootName, fileSystemOptions, httpClient, httpClientContext);
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileProvider.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileProvider.java
index 31a907228..f424b6ca3 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileProvider.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileProvider.java
@@ -332,11 +332,9 @@ public class Http5FileProvider extends AbstractOriginatingFileProvider {
protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions)
throws FileSystemException {
final GenericFileName rootName = (GenericFileName) name;
-
UserAuthenticationData authData = null;
HttpClient httpClient;
HttpClientContext httpClientContext;
-
try {
final Http5FileSystemConfigBuilder builder = Http5FileSystemConfigBuilder.getInstance();
authData = UserAuthenticatorUtils.authenticate(fileSystemOptions, AUTHENTICATOR_TYPES);
@@ -345,7 +343,6 @@ public class Http5FileProvider extends AbstractOriginatingFileProvider {
} finally {
UserAuthenticatorUtils.cleanup(authData);
}
-
return new Http5FileSystem(rootName, fileSystemOptions, httpClient, httpClientContext);
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/DefaultLocalFileProvider.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/DefaultLocalFileProvider.java
index c75d4a2e2..12fb1c942 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/DefaultLocalFileProvider.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/DefaultLocalFileProvider.java
@@ -58,6 +58,8 @@ public class DefaultLocalFileProvider extends AbstractOriginatingFileProvider im
/**
* Creates the file system.
+ *
+ * @return a new FileSystem, never null.
*/
@Override
protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions)
@@ -89,11 +91,8 @@ public class DefaultLocalFileProvider extends AbstractOriginatingFileProvider im
@Override
public FileObject findLocalFile(final String name) throws FileSystemException {
final String scheme = "file:";
- final StringBuilder uri = new StringBuilder(name.length() + scheme.length());
- uri.append(scheme);
- uri.append(name);
- final FileName fileName = parseUri(null, uri.toString());
- return findFile(fileName, null);
+ final StringBuilder builder = new StringBuilder(name.length() + scheme.length());
+ return findFile(parseUri(null, builder.append(scheme).append(name).toString()), null);
}
@Override