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/28 16:40:15 UTC
[commons-vfs] branch master updated: Fix Checkstyle DeclarationOrder.
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 e5a6449 Fix Checkstyle DeclarationOrder.
e5a6449 is described below
commit e5a6449a497e5ca0501ad9878e9052e2bbe2c6c1
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Nov 28 11:40:12 2021 -0500
Fix Checkstyle DeclarationOrder.
Also sorts methods. Drop separator in-line comments. Format tweaks.
---
.../apache/commons/vfs2/FileSystemException.java | 92 ++++++-------
.../java/org/apache/commons/vfs2/FileUtil.java | 14 +-
.../src/main/java/org/apache/commons/vfs2/VFS.java | 8 +-
.../apache/commons/vfs2/filter/AgeFileFilter.java | 46 +++----
.../org/apache/commons/vfs2/filter/IOCase.java | 145 ++++++++++-----------
.../commons/vfs2/provider/AbstractFileObject.java | 66 +++++-----
.../apache/commons/vfs2/provider/UriParser.java | 108 +++++++--------
.../vfs2/provider/ftp/FtpClientFactory.java | 6 +-
.../vfs2/provider/ftp/FtpFileNameParser.java | 14 +-
.../provider/ftp/FtpFileSystemConfigBuilder.java | 28 ++--
.../provider/hdfs/HdfsFileSystemConfigBuilder.java | 8 +-
.../vfs2/provider/http/HttpClientFactory.java | 6 +-
.../vfs2/provider/http/HttpFileNameParser.java | 14 +-
.../provider/http/HttpFileSystemConfigBuilder.java | 18 +--
.../vfs2/provider/http4/Http4FileNameParser.java | 14 +-
.../http4/Http4FileSystemConfigBuilder.java | 18 +--
.../vfs2/provider/http4s/Http4sFileNameParser.java | 14 +-
.../vfs2/provider/http5/Http5FileNameParser.java | 14 +-
.../http5/Http5FileSystemConfigBuilder.java | 48 +++----
.../vfs2/provider/http5s/Http5sFileNameParser.java | 14 +-
.../vfs2/provider/https/HttpsFileNameParser.java | 14 +-
.../vfs2/provider/sftp/SftpClientFactory.java | 9 +-
.../vfs2/provider/sftp/SftpFileNameParser.java | 14 +-
.../vfs2/provider/sftp/SftpFileProvider.java | 14 +-
.../provider/sftp/SftpFileSystemConfigBuilder.java | 8 +-
.../provider/zip/ZipFileSystemConfigBuilder.java | 14 +-
.../apache/commons/vfs2/util/FileObjectUtils.java | 8 +-
.../org/apache/commons/vfs2/util/Messages.java | 8 +-
.../org/apache/commons/vfs2/util/URIBitSets.java | 6 +-
.../org/apache/commons/vfs2/util/URIUtils.java | 20 +--
30 files changed, 402 insertions(+), 408 deletions(-)
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemException.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemException.java
index 8422022..bd9b1b7 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemException.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemException.java
@@ -45,52 +45,6 @@ public class FileSystemException extends IOException {
private final String[] info;
/**
- * Throws a FileSystemException when the given object is null.
- *
- * @param obj
- * the object reference to check for null.
- * @param code
- * message used when {@code
- * FileSystemException} is thrown
- * @param <T>
- * the type of the reference
- * @return {@code obj} if not {@code null}
- * @throws FileSystemException
- * if {@code obj} is {@code null}
- * @since 2.3
- */
- public static <T> T requireNonNull(final T obj, final String code) throws FileSystemException {
- if (obj == null) {
- throw new FileSystemException(code);
- }
- return obj;
- }
-
- /**
- * Throws a FileSystemException when the given object is null.
- *
- * @param obj
- * the object reference to check for null.
- * @param code
- * message used when {@code
- * FileSystemException} is thrown
- * @param info
- * one context information.
- * @param <T>
- * the type of the reference
- * @return {@code obj} if not {@code null}
- * @throws FileSystemException
- * if {@code obj} is {@code null}
- * @since 2.3
- */
- public static <T> T requireNonNull(final T obj, final String code, final Object... info) throws FileSystemException {
- if (obj == null) {
- throw new FileSystemException(code, info);
- }
- return obj;
- }
-
- /**
* Constructs exception with the specified detail message.
*
* @param code the error code of the message.
@@ -189,6 +143,52 @@ public class FileSystemException extends IOException {
}
/**
+ * Throws a FileSystemException when the given object is null.
+ *
+ * @param obj
+ * the object reference to check for null.
+ * @param code
+ * message used when {@code
+ * FileSystemException} is thrown
+ * @param <T>
+ * the type of the reference
+ * @return {@code obj} if not {@code null}
+ * @throws FileSystemException
+ * if {@code obj} is {@code null}
+ * @since 2.3
+ */
+ public static <T> T requireNonNull(final T obj, final String code) throws FileSystemException {
+ if (obj == null) {
+ throw new FileSystemException(code);
+ }
+ return obj;
+ }
+
+ /**
+ * Throws a FileSystemException when the given object is null.
+ *
+ * @param obj
+ * the object reference to check for null.
+ * @param code
+ * message used when {@code
+ * FileSystemException} is thrown
+ * @param info
+ * one context information.
+ * @param <T>
+ * the type of the reference
+ * @return {@code obj} if not {@code null}
+ * @throws FileSystemException
+ * if {@code obj} is {@code null}
+ * @since 2.3
+ */
+ public static <T> T requireNonNull(final T obj, final String code, final Object... info) throws FileSystemException {
+ if (obj == null) {
+ throw new FileSystemException(code, info);
+ }
+ return obj;
+ }
+
+ /**
* Retrieves message from bundle.
*
* @return The exception message.
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileUtil.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileUtil.java
index 2e616c4..7157a33 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileUtil.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileUtil.java
@@ -30,6 +30,13 @@ import org.apache.commons.vfs2.util.FileObjectUtils;
public final class FileUtil {
/**
+ * No instances.
+ */
+ private FileUtil() {
+ // empty
+ }
+
+ /**
* Copies the content from a source file to a destination file.
*
* @param srcFile The source FileObject.
@@ -71,11 +78,4 @@ public final class FileUtil {
FileObjectUtils.writeContent(file, output);
}
- /**
- * No instances.
- */
- private FileUtil() {
- // empty
- }
-
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/VFS.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/VFS.java
index a3b1b97..bd93da1 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/VFS.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/VFS.java
@@ -33,6 +33,10 @@ public final class VFS {
/** The URI style */
private static Boolean uriStyle;
+ private VFS() {
+ // no public instantiation.
+ }
+
/**
* Closes the default {@link FileSystemManager} instance.
* <p>
@@ -138,8 +142,4 @@ public final class VFS {
}
VFS.uriStyle = Boolean.valueOf(uriStyle);
}
-
- private VFS() {
- // no public instantiation.
- }
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/AgeFileFilter.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/AgeFileFilter.java
index 5ef2ac1..04c02a0 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/AgeFileFilter.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/AgeFileFilter.java
@@ -61,29 +61,6 @@ public class AgeFileFilter implements FileFilter, Serializable {
private final long cutoff;
/**
- * Tests if the specified {@code File} is newer than the specified time
- * reference.
- *
- * @param fileObject the {@code File} of which the modification date must
- * be compared, must not be {@code null}
- * @param timeMillis the time reference measured in milliseconds since the epoch
- * (00:00:00 GMT, January 1, 1970)
- * @return true if the {@code File} exists and has been modified after the
- * given time reference.
- * @throws FileSystemException Thrown for file system errors.
- * @throws IllegalArgumentException if the file is {@code null}
- */
- private static boolean isFileNewer(final FileObject fileObject, final long timeMillis) throws FileSystemException {
- Objects.requireNonNull(fileObject, "fileObject");
- if (!fileObject.exists()) {
- return false;
- }
- try (FileContent content = fileObject.getContent()) {
- return content.getLastModifiedTime() > timeMillis;
- }
- }
-
- /**
* Constructs a new age file filter for files older than (at or before) a
* certain cutoff date.
*
@@ -159,6 +136,29 @@ public class AgeFileFilter implements FileFilter, Serializable {
}
/**
+ * Tests if the specified {@code File} is newer than the specified time
+ * reference.
+ *
+ * @param fileObject the {@code File} of which the modification date must
+ * be compared, must not be {@code null}
+ * @param timeMillis the time reference measured in milliseconds since the epoch
+ * (00:00:00 GMT, January 1, 1970)
+ * @return true if the {@code File} exists and has been modified after the
+ * given time reference.
+ * @throws FileSystemException Thrown for file system errors.
+ * @throws IllegalArgumentException if the file is {@code null}
+ */
+ private static boolean isFileNewer(final FileObject fileObject, final long timeMillis) throws FileSystemException {
+ Objects.requireNonNull(fileObject, "fileObject");
+ if (!fileObject.exists()) {
+ return false;
+ }
+ try (FileContent content = fileObject.getContent()) {
+ return content.getLastModifiedTime() > timeMillis;
+ }
+ }
+
+ /**
* Checks to see if the last modification of the file matches cutoff favorably.
* <p>
* If last modification time equals cutoff and newer files are required, file
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/IOCase.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/IOCase.java
index 34bd5b6..06e5b55 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/IOCase.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/filter/IOCase.java
@@ -73,24 +73,6 @@ public enum IOCase {
/** The sensitivity flag. */
private final transient boolean sensitive;
- // -----------------------------------------------------------------------
- /**
- * Factory method to create an IOCase from a name.
- *
- * @param name the name to find
- * @return the IOCase object
- * @throws IllegalArgumentException if the name is invalid
- */
- public static IOCase forName(final String name) {
- for (final IOCase ioCase : IOCase.values()) {
- if (ioCase.getName().equals(name)) {
- return ioCase;
- }
- }
- throw new IllegalArgumentException("Invalid IOCase name: " + name);
- }
-
- // -----------------------------------------------------------------------
/**
* Constructs a new instance.
*
@@ -103,35 +85,21 @@ public enum IOCase {
}
/**
- * Replaces the enumeration from the stream with a real one. This ensures that
- * the correct flag is set for SYSTEM.
- *
- * @return the resolved object
- */
- private Object readResolve() {
- return forName(name);
- }
-
- // -----------------------------------------------------------------------
- /**
- * Gets the name of the constant.
- *
- * @return the name of the constant
- */
- public String getName() {
- return name;
- }
-
- /**
- * Does the object represent case sensitive comparison.
+ * Factory method to create an IOCase from a name.
*
- * @return true if case sensitive
+ * @param name the name to find
+ * @return the IOCase object
+ * @throws IllegalArgumentException if the name is invalid
*/
- public boolean isCaseSensitive() {
- return sensitive;
+ public static IOCase forName(final String name) {
+ for (final IOCase ioCase : IOCase.values()) {
+ if (ioCase.getName().equals(name)) {
+ return ioCase;
+ }
+ }
+ throw new IllegalArgumentException("Invalid IOCase name: " + name);
}
- // -----------------------------------------------------------------------
/**
* Compares two strings using the case-sensitivity rule.
* <p>
@@ -151,52 +119,37 @@ public enum IOCase {
}
/**
- * Compares two strings using the case-sensitivity rule.
+ * Checks if one string ends with another using the case-sensitivity rule.
* <p>
- * This method mimics {@link String#equals} but takes case-sensitivity into
+ * This method mimics {@link String#endsWith} but takes case-sensitivity into
* account.
*
- * @param str1 the first string to compare, not null
- * @param str2 the second string to compare, not null
- * @return true if equal using the case rules
- * @throws NullPointerException if either string is null
- */
- public boolean checkEquals(final String str1, final String str2) {
- if (str1 == null || str2 == null) {
- throw new NullPointerException("The strings must not be null");
- }
- return sensitive ? str1.equals(str2) : str1.equalsIgnoreCase(str2);
- }
-
- /**
- * Checks if one string starts with another using the case-sensitivity rule.
- * <p>
- * This method mimics {@link String#startsWith(String)} but takes
- * case-sensitivity into account.
- *
- * @param str the string to check, not null
- * @param start the start to compare against, not null
+ * @param str the string to check, not null
+ * @param end the end to compare against, not null
* @return true if equal using the case rules
* @throws NullPointerException if either string is null
*/
- public boolean checkStartsWith(final String str, final String start) {
- return str.regionMatches(!sensitive, 0, start, 0, start.length());
+ public boolean checkEndsWith(final String str, final String end) {
+ final int endLen = end.length();
+ return str.regionMatches(!sensitive, str.length() - endLen, end, 0, endLen);
}
/**
- * Checks if one string ends with another using the case-sensitivity rule.
+ * Compares two strings using the case-sensitivity rule.
* <p>
- * This method mimics {@link String#endsWith} but takes case-sensitivity into
+ * This method mimics {@link String#equals} but takes case-sensitivity into
* account.
*
- * @param str the string to check, not null
- * @param end the end to compare against, not null
+ * @param str1 the first string to compare, not null
+ * @param str2 the second string to compare, not null
* @return true if equal using the case rules
* @throws NullPointerException if either string is null
*/
- public boolean checkEndsWith(final String str, final String end) {
- final int endLen = end.length();
- return str.regionMatches(!sensitive, str.length() - endLen, end, 0, endLen);
+ public boolean checkEquals(final String str1, final String str2) {
+ if (str1 == null || str2 == null) {
+ throw new NullPointerException("The strings must not be null");
+ }
+ return sensitive ? str1.equals(str2) : str1.equalsIgnoreCase(str2);
}
/**
@@ -244,7 +197,49 @@ public enum IOCase {
return str.regionMatches(!sensitive, strStartIndex, search, 0, search.length());
}
- // -----------------------------------------------------------------------
+ /**
+ * Checks if one string starts with another using the case-sensitivity rule.
+ * <p>
+ * This method mimics {@link String#startsWith(String)} but takes
+ * case-sensitivity into account.
+ *
+ * @param str the string to check, not null
+ * @param start the start to compare against, not null
+ * @return true if equal using the case rules
+ * @throws NullPointerException if either string is null
+ */
+ public boolean checkStartsWith(final String str, final String start) {
+ return str.regionMatches(!sensitive, 0, start, 0, start.length());
+ }
+
+ /**
+ * Gets the name of the constant.
+ *
+ * @return the name of the constant
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Does the object represent case sensitive comparison.
+ *
+ * @return true if case sensitive
+ */
+ public boolean isCaseSensitive() {
+ return sensitive;
+ }
+
+ /**
+ * Replaces the enumeration from the stream with a real one. This ensures that
+ * the correct flag is set for SYSTEM.
+ *
+ * @return the resolved object
+ */
+ private Object readResolve() {
+ return forName(name);
+ }
+
/**
* Gets a string describing the sensitivity.
*
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 06ed144..116d7b2 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
@@ -76,6 +76,39 @@ public abstract class AbstractFileObject<AFS extends AbstractFileSystem> impleme
private static final int INITIAL_LIST_SIZE = 5;
+ private final AbstractFileName fileName;
+ private final AFS fileSystem;
+
+ private FileContent content;
+ // Cached info
+ private boolean attached;
+ private FileType type;
+
+ private FileObject parent;
+ // Changed to hold only the name of the children and let the object
+ // go into the global files cache
+ // private FileObject[] children;
+ private FileName[] children;
+
+ private List<Object> objects;
+
+ /**
+ * FileServices instance.
+ */
+ private FileOperations operations;
+
+ /**
+ * Constructs a new instance.
+ *
+ * @param fileName the file name.
+ * @param fileSystem the file system.
+ */
+ protected AbstractFileObject(final AbstractFileName fileName, final AFS fileSystem) {
+ this.fileName = fileName;
+ this.fileSystem = fileSystem;
+ fileSystem.fileObjectHanded(this);
+ }
+
/**
* Traverses a file.
*/
@@ -112,39 +145,6 @@ public abstract class AbstractFileObject<AFS extends AbstractFileSystem> impleme
}
}
}
- private final AbstractFileName fileName;
-
- private final AFS fileSystem;
- private FileContent content;
- // Cached info
- private boolean attached;
-
- private FileType type;
- private FileObject parent;
-
- // Changed to hold only the name of the children and let the object
- // go into the global files cache
- // private FileObject[] children;
- private FileName[] children;
-
- private List<Object> objects;
-
- /**
- * FileServices instance.
- */
- private FileOperations operations;
-
- /**
- * Constructs a new instance.
- *
- * @param fileName the file name.
- * @param fileSystem the file system.
- */
- protected AbstractFileObject(final AbstractFileName fileName, final AFS fileSystem) {
- this.fileName = fileName;
- this.fileSystem = fileSystem;
- fileSystem.fileObjectHanded(this);
- }
/**
* Attaches to the file.
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java
index 9ba6d8e..eb8e1e6 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java
@@ -47,6 +47,9 @@ public final class UriParser {
private static final char LOW_MASK = 0x0F;
+ private UriParser() {
+ }
+
/**
* Encodes and appends a string to a StringBuilder.
*
@@ -324,57 +327,6 @@ public final class UriParser {
}
/**
- * Extracts the scheme from a URI. Removes the scheme and ':' delimiter from the front of the URI.
- * <p>
- * The scheme is extracted based on the currently supported schemes in the system. That is to say the schemes
- * supported by the registered providers.
- * </p>
- * <p>
- * This allows us to handle varying scheme's without making assumptions based on the ':' character. Specifically
- * handle scheme extraction calls for URI parameters that are not actually uri's, but may be names with ':' in them.
- * </p>
- * @param schemes The schemes to check.
- * @param uri The potential URI. May also be a name.
- * @return The scheme name. Returns null if there is no scheme.
- * @since 2.3
- */
- public static String extractScheme(final String[] schemes, final String uri) {
- return extractScheme(schemes, uri, null);
- }
-
- /**
- * Extracts the scheme from a URI. Removes the scheme and ':' delimiter from the front of the URI.
- * <p>
- * The scheme is extracted based on the given set of schemes. Normally, that is to say the schemes
- * supported by the registered providers.
- * </p>
- * <p>
- * This allows us to handle varying scheme's without making assumptions based on the ':' character. Specifically
- * handle scheme extraction calls for URI parameters that are not actually URI's, but may be names with ':' in them.
- * </p>
- * @param schemes The schemes to check.
- * @param uri The potential URI. May also just be a name.
- * @param buffer Returns the remainder of the URI.
- * @return The scheme name. Returns null if there is no scheme.
- * @since 2.3
- */
- public static String extractScheme(final String[] schemes, final String uri, final StringBuilder buffer) {
- if (buffer != null) {
- buffer.setLength(0);
- buffer.append(uri);
- }
- for (final String scheme : schemes) {
- if (uri.startsWith(scheme + ":")) {
- if (buffer != null) {
- buffer.delete(0, uri.indexOf(':') + 1);
- }
- return scheme;
- }
- }
- return null;
- }
-
- /**
* Extracts the scheme from a URI.
*
* @param uri The URI.
@@ -436,6 +388,57 @@ public final class UriParser {
}
/**
+ * Extracts the scheme from a URI. Removes the scheme and ':' delimiter from the front of the URI.
+ * <p>
+ * The scheme is extracted based on the currently supported schemes in the system. That is to say the schemes
+ * supported by the registered providers.
+ * </p>
+ * <p>
+ * This allows us to handle varying scheme's without making assumptions based on the ':' character. Specifically
+ * handle scheme extraction calls for URI parameters that are not actually uri's, but may be names with ':' in them.
+ * </p>
+ * @param schemes The schemes to check.
+ * @param uri The potential URI. May also be a name.
+ * @return The scheme name. Returns null if there is no scheme.
+ * @since 2.3
+ */
+ public static String extractScheme(final String[] schemes, final String uri) {
+ return extractScheme(schemes, uri, null);
+ }
+
+ /**
+ * Extracts the scheme from a URI. Removes the scheme and ':' delimiter from the front of the URI.
+ * <p>
+ * The scheme is extracted based on the given set of schemes. Normally, that is to say the schemes
+ * supported by the registered providers.
+ * </p>
+ * <p>
+ * This allows us to handle varying scheme's without making assumptions based on the ':' character. Specifically
+ * handle scheme extraction calls for URI parameters that are not actually URI's, but may be names with ':' in them.
+ * </p>
+ * @param schemes The schemes to check.
+ * @param uri The potential URI. May also just be a name.
+ * @param buffer Returns the remainder of the URI.
+ * @return The scheme name. Returns null if there is no scheme.
+ * @since 2.3
+ */
+ public static String extractScheme(final String[] schemes, final String uri, final StringBuilder buffer) {
+ if (buffer != null) {
+ buffer.setLength(0);
+ buffer.append(uri);
+ }
+ for (final String scheme : schemes) {
+ if (uri.startsWith(scheme + ":")) {
+ if (buffer != null) {
+ buffer.delete(0, uri.indexOf(':') + 1);
+ }
+ return scheme;
+ }
+ }
+ return null;
+ }
+
+ /**
* Normalises the separators in a name.
*
* @param name The StringBuilder containing the name
@@ -543,7 +546,4 @@ public final class UriParser {
return fileType;
}
-
- private UriParser() {
- }
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpClientFactory.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpClientFactory.java
index dcdadcd..db73c81 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpClientFactory.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpClientFactory.java
@@ -274,6 +274,9 @@ public final class FtpClientFactory {
}
}
+ private FtpClientFactory() {
+ }
+
/**
* Creates a new connection to the server.
*
@@ -292,7 +295,4 @@ public final class FtpClientFactory {
final FtpConnectionFactory factory = new FtpConnectionFactory(FtpFileSystemConfigBuilder.getInstance());
return factory.createConnection(hostname, port, username, password, workingDirectory, fileSystemOptions);
}
-
- private FtpClientFactory() {
- }
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileNameParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileNameParser.java
index 8f7e17e..8798226 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileNameParser.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileNameParser.java
@@ -29,6 +29,13 @@ public class FtpFileNameParser extends HostFileNameParser {
private static final int PORT = 21;
/**
+ * Constructs a new instance with the default port.
+ */
+ public FtpFileNameParser() {
+ super(PORT);
+ }
+
+ /**
* Gets the singleton instance.
*
* @return the singleton instance.
@@ -36,11 +43,4 @@ public class FtpFileNameParser extends HostFileNameParser {
public static FileNameParser getInstance() {
return INSTANCE;
}
-
- /**
- * Constructs a new instance with the default port.
- */
- public FtpFileNameParser() {
- super(PORT);
- }
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java
index 01e6e39..fe3c092 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java
@@ -59,6 +59,20 @@ public class FtpFileSystemConfigBuilder extends FileSystemConfigBuilder {
private static final String TRANSFER_ABORTED_OK_REPLY_CODES = PREFIX + ".TRANSFER_ABORTED_OK_REPLY_CODES";
private static final String MDTM_LAST_MODIFED_TIME = PREFIX + ".MDTM_LAST_MODIFED_TIME";
+ private FtpFileSystemConfigBuilder() {
+ super("ftp.");
+ }
+
+ /**
+ * Create new config builder with specified prefix string.
+ *
+ * @param prefix prefix string to use for parameters of this config builder.
+ * @since 2.1
+ */
+ protected FtpFileSystemConfigBuilder(final String prefix) {
+ super(prefix);
+ }
+
/**
* Gets the singleton instance.
*
@@ -80,20 +94,6 @@ public class FtpFileSystemConfigBuilder extends FileSystemConfigBuilder {
return new ArrayList<>(Arrays.asList(FTPReply.TRANSFER_ABORTED, FTPReply.FILE_UNAVAILABLE));
}
- private FtpFileSystemConfigBuilder() {
- super("ftp.");
- }
-
- /**
- * Create new config builder with specified prefix string.
- *
- * @param prefix prefix string to use for parameters of this config builder.
- * @since 2.1
- */
- protected FtpFileSystemConfigBuilder(final String prefix) {
- super(prefix);
- }
-
/**
* Gets whether to try to autodetect the server encoding (only UTF8 is supported).
*
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileSystemConfigBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileSystemConfigBuilder.java
index 4c9a3b3..b0fb6bb 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileSystemConfigBuilder.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileSystemConfigBuilder.java
@@ -42,6 +42,10 @@ public final class HdfsFileSystemConfigBuilder extends FileSystemConfigBuilder {
private static final String KEY_CONFIG_STREAM = "configStream";
private static final String KEY_CONFIG_CONF = "configConf";
+ private HdfsFileSystemConfigBuilder() {
+ super("hdfs.");
+ }
+
/**
* @return HdfsFileSystemConfigBuilder instance
*/
@@ -49,10 +53,6 @@ public final class HdfsFileSystemConfigBuilder extends FileSystemConfigBuilder {
return BUILDER;
}
- private HdfsFileSystemConfigBuilder() {
- super("hdfs.");
- }
-
/**
* @return HDFSFileSystem
*/
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpClientFactory.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpClientFactory.java
index baa9db3..022bda7 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpClientFactory.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpClientFactory.java
@@ -38,6 +38,9 @@ import org.apache.commons.vfs2.util.UserAuthenticatorUtils;
*/
public final class HttpClientFactory {
+ private HttpClientFactory() {
+ }
+
/**
* Creates a new connection to the server.
*
@@ -146,7 +149,4 @@ public final class HttpClientFactory {
return createConnection(HttpFileSystemConfigBuilder.getInstance(), scheme, hostname, port, username, password, fileSystemOptions);
}
- private HttpClientFactory() {
- }
-
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileNameParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileNameParser.java
index 31b1e1e..40cde24 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileNameParser.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileNameParser.java
@@ -29,6 +29,13 @@ public class HttpFileNameParser extends URLFileNameParser {
private static final HttpFileNameParser INSTANCE = new HttpFileNameParser();
/**
+ * Creates a new instance with the default port 80.
+ */
+ public HttpFileNameParser() {
+ super(DEFAULT_PORT);
+ }
+
+ /**
* Gets the singleton instance.
*
* @return the singleton instance.
@@ -36,11 +43,4 @@ public class HttpFileNameParser extends URLFileNameParser {
public static FileNameParser getInstance() {
return INSTANCE;
}
-
- /**
- * Creates a new instance with the default port 80.
- */
- public HttpFileNameParser() {
- super(DEFAULT_PORT);
- }
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileSystemConfigBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileSystemConfigBuilder.java
index 30c52af..b1d67c8 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileSystemConfigBuilder.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileSystemConfigBuilder.java
@@ -57,15 +57,6 @@ public class HttpFileSystemConfigBuilder extends FileSystemConfigBuilder {
private static final String KEY_PREEMPTIVE_AUTHENTICATION = "preemptiveAuth";
- /**
- * Gets the singleton builder.
- *
- * @return the singleton builder.
- */
- public static HttpFileSystemConfigBuilder getInstance() {
- return BUILDER;
- }
-
private HttpFileSystemConfigBuilder() {
super("http.");
}
@@ -80,6 +71,15 @@ public class HttpFileSystemConfigBuilder extends FileSystemConfigBuilder {
super(prefix);
}
+ /**
+ * Gets the singleton builder.
+ *
+ * @return the singleton builder.
+ */
+ public static HttpFileSystemConfigBuilder getInstance() {
+ return BUILDER;
+ }
+
@Override
protected Class<? extends FileSystem> getConfigClass() {
return HttpFileSystem.class;
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileNameParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileNameParser.java
index 0c0b39d..9c658ac 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileNameParser.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileNameParser.java
@@ -31,6 +31,13 @@ public class Http4FileNameParser extends GenericURLFileNameParser {
private static final Http4FileNameParser INSTANCE = new Http4FileNameParser();
/**
+ * Creates a new instance with the default port 80.
+ */
+ public Http4FileNameParser() {
+ super(DEFAULT_PORT);
+ }
+
+ /**
* Gets the singleton instance.
*
* @return the singleton instance.
@@ -38,11 +45,4 @@ public class Http4FileNameParser extends GenericURLFileNameParser {
public static FileNameParser getInstance() {
return INSTANCE;
}
-
- /**
- * Creates a new instance with the default port 80.
- */
- public Http4FileNameParser() {
- super(DEFAULT_PORT);
- }
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileSystemConfigBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileSystemConfigBuilder.java
index 47da886..4366829 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileSystemConfigBuilder.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileSystemConfigBuilder.java
@@ -176,15 +176,6 @@ public class Http4FileSystemConfigBuilder extends FileSystemConfigBuilder {
*/
private static final String PROXY_SCHEME = "proxyScheme";
- /**
- * Gets the singleton builder.
- *
- * @return the singleton builder.
- */
- public static Http4FileSystemConfigBuilder getInstance() {
- return BUILDER;
- }
-
private Http4FileSystemConfigBuilder() {
super("http.");
}
@@ -198,6 +189,15 @@ public class Http4FileSystemConfigBuilder extends FileSystemConfigBuilder {
super(prefix);
}
+ /**
+ * Gets the singleton builder.
+ *
+ * @return the singleton builder.
+ */
+ public static Http4FileSystemConfigBuilder getInstance() {
+ return BUILDER;
+ }
+
@Override
protected Class<? extends FileSystem> getConfigClass() {
return Http4FileSystem.class;
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4s/Http4sFileNameParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4s/Http4sFileNameParser.java
index 38bb2eb..669ca94 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4s/Http4sFileNameParser.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4s/Http4sFileNameParser.java
@@ -31,6 +31,13 @@ public class Http4sFileNameParser extends GenericURLFileNameParser {
private static final Http4sFileNameParser INSTANCE = new Http4sFileNameParser();
/**
+ * Creates a new instance with the default port 443.
+ */
+ public Http4sFileNameParser() {
+ super(DEFAULT_PORT);
+ }
+
+ /**
* Gets the singleton instance.
*
* @return the singleton instance.
@@ -38,11 +45,4 @@ public class Http4sFileNameParser extends GenericURLFileNameParser {
public static FileNameParser getInstance() {
return INSTANCE;
}
-
- /**
- * Creates a new instance with the default port 443.
- */
- public Http4sFileNameParser() {
- super(DEFAULT_PORT);
- }
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileNameParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileNameParser.java
index a6e31f5..5adfcf4 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileNameParser.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileNameParser.java
@@ -31,6 +31,13 @@ public class Http5FileNameParser extends GenericURLFileNameParser {
private static final Http5FileNameParser INSTANCE = new Http5FileNameParser();
/**
+ * Creates a new instance with the default port 80.
+ */
+ public Http5FileNameParser() {
+ super(DEFAULT_PORT);
+ }
+
+ /**
* Gets the singleton instance.
*
* @return the singleton instance.
@@ -38,11 +45,4 @@ public class Http5FileNameParser extends GenericURLFileNameParser {
public static FileNameParser getInstance() {
return INSTANCE;
}
-
- /**
- * Creates a new instance with the default port 80.
- */
- public Http5FileNameParser() {
- super(DEFAULT_PORT);
- }
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileSystemConfigBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileSystemConfigBuilder.java
index 3235db7..e8eeaee 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileSystemConfigBuilder.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileSystemConfigBuilder.java
@@ -196,15 +196,6 @@ public class Http5FileSystemConfigBuilder extends FileSystemConfigBuilder {
*/
private static final String DEFAULT_TLS_VERSIONS = "V_1_2";
- /**
- * Gets the singleton builder.
- *
- * @return the singleton builder.
- */
- public static Http5FileSystemConfigBuilder getInstance() {
- return BUILDER;
- }
-
private Http5FileSystemConfigBuilder() {
super("http.");
}
@@ -218,6 +209,15 @@ public class Http5FileSystemConfigBuilder extends FileSystemConfigBuilder {
super(prefix);
}
+ /**
+ * Gets the singleton builder.
+ *
+ * @return the singleton builder.
+ */
+ public static Http5FileSystemConfigBuilder getInstance() {
+ return BUILDER;
+ }
+
@Override
protected Class<? extends FileSystem> getConfigClass() {
return Http5FileSystem.class;
@@ -453,11 +453,10 @@ public class Http5FileSystemConfigBuilder extends FileSystemConfigBuilder {
*
* @param opts The FileSystem options.
* @param connectionTimeout The connection timeout.
- * @deprecated Use {@link #setConnectionTimeout(FileSystemOptions, Duration)}.
+ * @since 2.8.0
*/
- @Deprecated
- public void setConnectionTimeout(final FileSystemOptions opts, final int connectionTimeout) {
- setConnectionTimeout(opts, Duration.ofMillis(connectionTimeout));
+ public void setConnectionTimeout(final FileSystemOptions opts, final Duration connectionTimeout) {
+ setParam(opts, CONNECTION_TIMEOUT, connectionTimeout);
}
/**
@@ -465,10 +464,11 @@ public class Http5FileSystemConfigBuilder extends FileSystemConfigBuilder {
*
* @param opts The FileSystem options.
* @param connectionTimeout The connection timeout.
- * @since 2.8.0
+ * @deprecated Use {@link #setConnectionTimeout(FileSystemOptions, Duration)}.
*/
- public void setConnectionTimeout(final FileSystemOptions opts, final Duration connectionTimeout) {
- setParam(opts, CONNECTION_TIMEOUT, connectionTimeout);
+ @Deprecated
+ public void setConnectionTimeout(final FileSystemOptions opts, final int connectionTimeout) {
+ setConnectionTimeout(opts, Duration.ofMillis(connectionTimeout));
}
/**
@@ -621,25 +621,25 @@ public class Http5FileSystemConfigBuilder extends FileSystemConfigBuilder {
}
/**
- * Sets the socket timeout.
+ * The socket timeout.
*
* @param opts The FileSystem options.
* @param soTimeout socket timeout.
- * @deprecated Use {@link #setSoTimeout(FileSystemOptions, Duration)}.
*/
- @Deprecated
- public void setSoTimeout(final FileSystemOptions opts, final int soTimeout) {
- setSoTimeout(opts, Duration.ofMillis(soTimeout));
+ public void setSoTimeout(final FileSystemOptions opts, final Duration soTimeout) {
+ setParam(opts, SO_TIMEOUT, soTimeout);
}
/**
- * The socket timeout.
+ * Sets the socket timeout.
*
* @param opts The FileSystem options.
* @param soTimeout socket timeout.
+ * @deprecated Use {@link #setSoTimeout(FileSystemOptions, Duration)}.
*/
- public void setSoTimeout(final FileSystemOptions opts, final Duration soTimeout) {
- setParam(opts, SO_TIMEOUT, soTimeout);
+ @Deprecated
+ public void setSoTimeout(final FileSystemOptions opts, final int soTimeout) {
+ setSoTimeout(opts, Duration.ofMillis(soTimeout));
}
/**
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5s/Http5sFileNameParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5s/Http5sFileNameParser.java
index 8fdec7c..7eb1bbe 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5s/Http5sFileNameParser.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5s/Http5sFileNameParser.java
@@ -31,6 +31,13 @@ public class Http5sFileNameParser extends GenericURLFileNameParser {
private static final Http5sFileNameParser INSTANCE = new Http5sFileNameParser();
/**
+ * Creates a new instance with the default port 443.
+ */
+ public Http5sFileNameParser() {
+ super(DEFAULT_PORT);
+ }
+
+ /**
* Gets the singleton instance.
*
* @return the singleton instance.
@@ -38,11 +45,4 @@ public class Http5sFileNameParser extends GenericURLFileNameParser {
public static FileNameParser getInstance() {
return INSTANCE;
}
-
- /**
- * Creates a new instance with the default port 443.
- */
- public Http5sFileNameParser() {
- super(DEFAULT_PORT);
- }
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/https/HttpsFileNameParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/https/HttpsFileNameParser.java
index a157923..c0df4a1 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/https/HttpsFileNameParser.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/https/HttpsFileNameParser.java
@@ -29,6 +29,13 @@ public class HttpsFileNameParser extends URLFileNameParser {
private static final HttpsFileNameParser INSTANCE = new HttpsFileNameParser();
/**
+ * Creates a new instance with the default port 443.
+ */
+ public HttpsFileNameParser() {
+ super(DEFAULT_PORT);
+ }
+
+ /**
* Gets the singleton instance.
*
* @return the singleton instance.
@@ -36,11 +43,4 @@ public class HttpsFileNameParser extends URLFileNameParser {
public static FileNameParser getInstance() {
return INSTANCE;
}
-
- /**
- * Creates a new instance with the default port 443.
- */
- public HttpsFileNameParser() {
- super(DEFAULT_PORT);
- }
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java
index 7018510..6b0d646 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java
@@ -61,7 +61,6 @@ public final class SftpClientFactory {
return LOG.isInfoEnabled();
default:
return LOG.isDebugEnabled();
-
}
}
@@ -88,15 +87,18 @@ public final class SftpClientFactory {
}
}
}
+
private static final String SSH_DIR_NAME = ".ssh";
private static final String OPENSSH_CONFIG_NAME = "config";
-
private static final Log LOG = LogFactory.getLog(SftpClientFactory.class);
static {
JSch.setLogger(new JSchLogger());
}
+ private SftpClientFactory() {
+ }
+
private static void addIdentities(final JSch jsch, final File sshDir, final IdentityProvider[] identities)
throws FileSystemException {
if (identities != null) {
@@ -335,7 +337,4 @@ public final class SftpClientFactory {
}
}
-
- private SftpClientFactory() {
- }
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileNameParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileNameParser.java
index a307b8b..f24a3e3 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileNameParser.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileNameParser.java
@@ -29,6 +29,13 @@ public class SftpFileNameParser extends URLFileNameParser {
private static final SftpFileNameParser INSTANCE = new SftpFileNameParser();
/**
+ * Creates a new instance with the default port 22.
+ */
+ public SftpFileNameParser() {
+ super(DEFAULT_PORT);
+ }
+
+ /**
* Gets the singleton instance.
*
* @return the singleton instance.
@@ -36,11 +43,4 @@ public class SftpFileNameParser extends URLFileNameParser {
public static FileNameParser getInstance() {
return INSTANCE;
}
-
- /**
- * Creates a new instance with the default port 22.
- */
- public SftpFileNameParser() {
- super(DEFAULT_PORT);
- }
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileProvider.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileProvider.java
index 576ee16..2be1afc 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileProvider.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileProvider.java
@@ -51,6 +51,13 @@ public class SftpFileProvider extends AbstractOriginatingFileProvider {
Capability.GET_LAST_MODIFIED, Capability.SET_LAST_MODIFIED_FILE, Capability.RANDOM_ACCESS_READ, Capability.APPEND_CONTENT));
/**
+ * Constructs a new provider.
+ */
+ public SftpFileProvider() {
+ setFileNameParser(SftpFileNameParser.getInstance());
+ }
+
+ /**
* Creates a new Session.
*
* @return A Session, never null.
@@ -75,13 +82,6 @@ public class SftpFileProvider extends AbstractOriginatingFileProvider {
}
/**
- * Constructs a new provider.
- */
- public SftpFileProvider() {
- setFileNameParser(SftpFileNameParser.getInstance());
- }
-
- /**
* Creates a {@link FileSystem}.
*/
@Override
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 c4302bb..5972182 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
@@ -128,6 +128,10 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder {
private static final String STRICT_HOST_KEY_CHECKING = PREFIX + ".STRICT_HOST_KEY_CHECKING";
private static final String USER_DIR_IS_ROOT = PREFIX + ".USER_DIR_IS_ROOT";
+ private SftpFileSystemConfigBuilder() {
+ super("sftp.");
+ }
+
/**
* Gets the singleton builder.
*
@@ -137,10 +141,6 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder {
return BUILDER;
}
- private SftpFileSystemConfigBuilder() {
- super("sftp.");
- }
-
/**
* @param options The FileSystem options.
* @return The names of the compression algorithms, comma-separated.
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 f22eeae..f66f928 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
@@ -30,6 +30,13 @@ public class ZipFileSystemConfigBuilder extends FileSystemConfigBuilder {
private static final String KEY_CHARSET = PREFIX + ".charset";
/**
+ * Constructs a new instance.
+ */
+ private ZipFileSystemConfigBuilder() {
+ super("zip.");
+ }
+
+ /**
* Gets the singleton instance.
*
* @return the singleton instance.
@@ -39,13 +46,6 @@ public class ZipFileSystemConfigBuilder extends FileSystemConfigBuilder {
}
/**
- * Constructs a new instance.
- */
- private ZipFileSystemConfigBuilder() {
- super("zip.");
- }
-
- /**
* Gets the Charset from the FileSystemOptions.
*
* @param fileSystemOptions The source FileSystemOptions.
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/FileObjectUtils.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/FileObjectUtils.java
index a671b4b..b4d1fd7 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/FileObjectUtils.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/FileObjectUtils.java
@@ -33,6 +33,10 @@ import org.apache.commons.vfs2.provider.AbstractFileObject;
*/
public final class FileObjectUtils {
+ private FileObjectUtils() {
+ // noop
+ }
+
/**
* Null-safe call to {@link FileObject#exists()}.
*
@@ -199,8 +203,4 @@ public final class FileObjectUtils {
content.write(output);
}
}
-
- private FileObjectUtils() {
- // noop
- }
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/Messages.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/Messages.java
index 7daae58..6e2e332 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/Messages.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/Messages.java
@@ -35,6 +35,10 @@ public final class Messages {
private static final ConcurrentMap<String, MessageFormat> MESSAGE_MAP = new ConcurrentHashMap<>();
private static final ResourceBundle RESOURCES = new CombinedResources("org.apache.commons.vfs2.Resources");
+ private Messages() {
+ // no instances.
+ }
+
/**
* Locates a message by its code.
*/
@@ -84,8 +88,4 @@ public final class Messages {
return "Unknown message with code \"" + code + "\".";
}
}
-
- private Messages() {
- // no instances.
- }
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/URIBitSets.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/URIBitSets.java
index 2206922..0aabd58 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/URIBitSets.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/URIBitSets.java
@@ -879,11 +879,11 @@ final class URIBitSets {
ALLOWED_FRAGMENT.clear('%');
}
- static BitSet createBitSet() {
- return new BitSet(NBITS);
+ private URIBitSets() {
}
- private URIBitSets() {
+ static BitSet createBitSet() {
+ return new BitSet(NBITS);
}
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/URIUtils.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/URIUtils.java
index 1df6a9c..f633165 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/URIUtils.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/URIUtils.java
@@ -48,6 +48,9 @@ public class URIUtils {
*/
private static final class EncodingUtils {
+ private EncodingUtils() {
+ }
+
/**
* Converts the byte array of ASCII characters to a string. This method is
* to be used when decoding content of HTTP elements (such as response
@@ -90,9 +93,6 @@ public class URIUtils {
return data.getBytes(Charset.defaultCharset());
}
}
-
- private EncodingUtils() {
- }
}
/**
@@ -136,7 +136,10 @@ public class URIUtils {
*/
private static final int RADIX = 16;
- static final byte[] encodeUrl(BitSet urlsafe, final byte[] bytes) {
+ private URLCodecUtils() {
+ }
+
+ static byte[] encodeUrl(BitSet urlsafe, final byte[] bytes) {
if (bytes == null) {
return null;
}
@@ -169,9 +172,6 @@ public class URIUtils {
private static char hexDigit(final int b) {
return Character.toUpperCase(Character.forDigit(b & 0xF, RADIX));
}
-
- private URLCodecUtils() {
- }
}
private static final Log LOG = LogFactory.getLog(URIUtils.class);
@@ -181,6 +181,9 @@ public class URIUtils {
*/
private static final String DEFAULT_PROTOCOL_CHARSET = "UTF-8";
+ private URIUtils() {
+ }
+
private static String encode(final String unescaped, final BitSet allowed, final String charset) {
final byte[] rawdata = URLCodecUtils.encodeUrl(allowed, EncodingUtils.getBytes(unescaped, charset));
return EncodingUtils.getAsciiString(rawdata, 0, rawdata.length);
@@ -213,7 +216,4 @@ public class URIUtils {
return encode(unescaped, URIBitSets.ALLOWED_ABS_PATH, charset);
}
- private URIUtils() {
- }
-
}