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/27 15:30:28 UTC
[commons-vfs] 02/02: Fix Checkstyle MissingJavadocMethod: Missing a Javadoc comment.
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 fba04f3e5ecf36e576b008b218d8c735e0949cb6
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 27 10:30:23 2021 -0500
Fix Checkstyle MissingJavadocMethod: Missing a Javadoc comment.
Better parameter names.
---
.../commons/vfs2/InvertIncludeFileSelector.java | 5 +
.../commons/vfs2/impl/DecoratedFileObject.java | 99 ++++++++++---------
.../commons/vfs2/impl/DefaultFileContentInfo.java | 7 ++
.../commons/vfs2/impl/DefaultFileReplicator.java | 3 +
.../vfs2/impl/PrivilegedFileReplicator.java | 5 +
.../commons/vfs2/impl/ProviderConfiguration.java | 39 ++++++++
.../commons/vfs2/impl/SynchronizedFileObject.java | 5 +
.../apache/commons/vfs2/impl/VirtualFileName.java | 15 ++-
.../commons/vfs2/impl/VirtualFileSystem.java | 10 +-
.../commons/vfs2/operations/vcs/VcsStatus.java | 107 ++++++++++++++++++++-
.../commons/vfs2/provider/AbstractFileName.java | 17 +++-
.../commons/vfs2/provider/AbstractFileObject.java | 12 +--
.../vfs2/provider/AbstractFileProvider.java | 9 +-
.../commons/vfs2/provider/AbstractFileSystem.java | 10 +-
.../vfs2/provider/AbstractLayeredFileProvider.java | 3 +
.../provider/AbstractOriginatingFileProvider.java | 3 +
.../vfs2/provider/CompositeFileProvider.java | 3 +
.../commons/vfs2/provider/DefaultFileContent.java | 10 +-
.../vfs2/provider/DefaultURLConnection.java | 24 +++--
.../vfs2/provider/DefaultURLStreamHandler.java | 12 +++
.../commons/vfs2/provider/DelegateFileObject.java | 17 +++-
.../commons/vfs2/provider/LayeredFileName.java | 8 ++
.../vfs2/provider/bzip2/Bzip2FileObject.java | 8 ++
.../vfs2/provider/bzip2/Bzip2FileProvider.java | 3 +
.../compressed/CompressedFileFileProvider.java | 3 +
.../vfs2/provider/local/LocalFileSystem.java | 11 ++-
.../commons/vfs2/provider/zip/ZipFileSystem.java | 13 ++-
.../commons/vfs2/util/WeakRefFileListener.java | 4 +-
28 files changed, 372 insertions(+), 93 deletions(-)
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/InvertIncludeFileSelector.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/InvertIncludeFileSelector.java
index 6541395..710a53d 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/InvertIncludeFileSelector.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/InvertIncludeFileSelector.java
@@ -25,6 +25,11 @@ import java.util.Objects;
*/
public class InvertIncludeFileSelector implements FileSelector {
+ /**
+ * Constructs a new instance.
+ *
+ * @param delegateFileSelector Delegate to this FileSelector.
+ */
public InvertIncludeFileSelector(final FileSelector delegateFileSelector) {
this.delegateFileSelector = Objects.requireNonNull(delegateFileSelector, "delegateFileSelector");
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java
index 9fe8d3e..3969e2d 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java
@@ -31,213 +31,224 @@ import org.apache.commons.vfs2.NameScope;
import org.apache.commons.vfs2.operations.FileOperations;
/**
- * Base class to build a fileObject decoration.
+ * Base class to build a FileObject decoration.
*/
public class DecoratedFileObject implements FileObject {
- private final FileObject decoratedFileObject;
- public DecoratedFileObject(final FileObject decoratedFileObject) {
- this.decoratedFileObject = decoratedFileObject;
+ private final FileObject fileObject;
+
+ /**
+ * Constructs a new instance to decorate the given FileObject.
+ *
+ * @param fileObject the FileObject to decorate.
+ */
+ public DecoratedFileObject(final FileObject fileObject) {
+ this.fileObject = fileObject;
}
@Override
public boolean canRenameTo(final FileObject newfile) {
- return decoratedFileObject.canRenameTo(newfile);
+ return fileObject.canRenameTo(newfile);
}
@Override
public void close() throws FileSystemException {
- decoratedFileObject.close();
+ fileObject.close();
}
@Override
public int compareTo(final FileObject fo) {
- return decoratedFileObject.compareTo(fo);
+ return fileObject.compareTo(fo);
}
@Override
public void copyFrom(final FileObject srcFile, final FileSelector selector) throws FileSystemException {
- decoratedFileObject.copyFrom(srcFile, selector);
+ fileObject.copyFrom(srcFile, selector);
}
@Override
public void createFile() throws FileSystemException {
- decoratedFileObject.createFile();
+ fileObject.createFile();
}
@Override
public void createFolder() throws FileSystemException {
- decoratedFileObject.createFolder();
+ fileObject.createFolder();
}
@Override
public boolean delete() throws FileSystemException {
- return decoratedFileObject.delete();
+ return fileObject.delete();
}
@Override
public int delete(final FileSelector selector) throws FileSystemException {
- return decoratedFileObject.delete(selector);
+ return fileObject.delete(selector);
}
@Override
public int deleteAll() throws FileSystemException {
- return decoratedFileObject.deleteAll();
+ return fileObject.deleteAll();
}
@Override
public boolean exists() throws FileSystemException {
- return decoratedFileObject.exists();
+ return fileObject.exists();
}
@Override
public FileObject[] findFiles(final FileSelector selector) throws FileSystemException {
- return decoratedFileObject.findFiles(selector);
+ return fileObject.findFiles(selector);
}
@Override
public void findFiles(final FileSelector selector, final boolean depthwise, final List<FileObject> selected)
throws FileSystemException {
- decoratedFileObject.findFiles(selector, depthwise, selected);
+ fileObject.findFiles(selector, depthwise, selected);
}
@Override
public FileObject getChild(final String name) throws FileSystemException {
- return decoratedFileObject.getChild(name);
+ return fileObject.getChild(name);
}
@Override
public FileObject[] getChildren() throws FileSystemException {
- return decoratedFileObject.getChildren();
+ return fileObject.getChildren();
}
@Override
public FileContent getContent() throws FileSystemException {
- return decoratedFileObject.getContent();
+ return fileObject.getContent();
}
+ /**
+ * Gets the decorated fileObject.
+ *
+ * @return the decorated fileObject.
+ */
public FileObject getDecoratedFileObject() {
- return decoratedFileObject;
+ return fileObject;
}
@Override
public FileOperations getFileOperations() throws FileSystemException {
- return decoratedFileObject.getFileOperations();
+ return fileObject.getFileOperations();
}
@Override
public FileSystem getFileSystem() {
- return decoratedFileObject.getFileSystem();
+ return fileObject.getFileSystem();
}
@Override
public String getPublicURIString() {
- return decoratedFileObject.getPublicURIString();
+ return fileObject.getPublicURIString();
}
@Override
public FileName getName() {
- return decoratedFileObject.getName();
+ return fileObject.getName();
}
@Override
public FileObject getParent() throws FileSystemException {
- return decoratedFileObject.getParent();
+ return fileObject.getParent();
}
@Override
public FileType getType() throws FileSystemException {
- return decoratedFileObject.getType();
+ return fileObject.getType();
}
@Override
public URL getURL() throws FileSystemException {
- return decoratedFileObject.getURL();
+ return fileObject.getURL();
}
@Override
public boolean isAttached() {
- return decoratedFileObject.isAttached();
+ return fileObject.isAttached();
}
@Override
public boolean isContentOpen() {
- return decoratedFileObject.isContentOpen();
+ return fileObject.isContentOpen();
}
@Override
public boolean isExecutable() throws FileSystemException {
- return decoratedFileObject.isExecutable();
+ return fileObject.isExecutable();
}
@Override
public boolean isFile() throws FileSystemException {
- return decoratedFileObject.isFile();
+ return fileObject.isFile();
}
@Override
public boolean isFolder() throws FileSystemException {
- return decoratedFileObject.isFolder();
+ return fileObject.isFolder();
}
@Override
public boolean isHidden() throws FileSystemException {
- return decoratedFileObject.isHidden();
+ return fileObject.isHidden();
}
@Override
public boolean isReadable() throws FileSystemException {
- return decoratedFileObject.isReadable();
+ return fileObject.isReadable();
}
@Override
public boolean isWriteable() throws FileSystemException {
- return decoratedFileObject.isWriteable();
+ return fileObject.isWriteable();
}
@Override
public Iterator<FileObject> iterator() {
- return decoratedFileObject.iterator();
+ return fileObject.iterator();
}
@Override
public void moveTo(final FileObject destFile) throws FileSystemException {
- decoratedFileObject.moveTo(destFile);
+ fileObject.moveTo(destFile);
}
@Override
public void refresh() throws FileSystemException {
- decoratedFileObject.refresh();
+ fileObject.refresh();
}
@Override
public FileObject resolveFile(final String path) throws FileSystemException {
- return decoratedFileObject.resolveFile(path);
+ return fileObject.resolveFile(path);
}
@Override
public FileObject resolveFile(final String name, final NameScope scope) throws FileSystemException {
- return decoratedFileObject.resolveFile(name, scope);
+ return fileObject.resolveFile(name, scope);
}
@Override
public boolean setExecutable(final boolean executable, final boolean ownerOnly) throws FileSystemException {
- return decoratedFileObject.setExecutable(executable, ownerOnly);
+ return fileObject.setExecutable(executable, ownerOnly);
}
@Override
public boolean setReadable(final boolean readable, final boolean ownerOnly) throws FileSystemException {
- return decoratedFileObject.setReadable(readable, ownerOnly);
+ return fileObject.setReadable(readable, ownerOnly);
}
@Override
public boolean setWritable(final boolean writable, final boolean ownerOnly) throws FileSystemException {
- return decoratedFileObject.setWritable(writable, ownerOnly);
+ return fileObject.setWritable(writable, ownerOnly);
}
@Override
public String toString() {
- return decoratedFileObject.toString();
+ return fileObject.toString();
}
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileContentInfo.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileContentInfo.java
index 51621c6..349ed3d 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileContentInfo.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileContentInfo.java
@@ -22,9 +22,16 @@ import org.apache.commons.vfs2.FileContentInfo;
* The default file content information.
*/
public class DefaultFileContentInfo implements FileContentInfo {
+
private final String contentType;
private final String contentEncoding;
+ /**
+ * Constructs a new instance.
+ *
+ * @param contentType A content type.
+ * @param contentEncoding A content encoding.
+ */
public DefaultFileContentInfo(final String contentType, final String contentEncoding) {
this.contentType = contentType;
this.contentEncoding = contentEncoding;
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileReplicator.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileReplicator.java
index be03ab8..e297d5b 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileReplicator.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileReplicator.java
@@ -49,6 +49,9 @@ public class DefaultFileReplicator extends AbstractVfsComponent implements FileR
private File tempDir;
private boolean tempDirMessageLogged;
+ /**
+ * Constructs a new instance.
+ */
public DefaultFileReplicator() {
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/PrivilegedFileReplicator.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/PrivilegedFileReplicator.java
index f25ac26..12a377e 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/PrivilegedFileReplicator.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/PrivilegedFileReplicator.java
@@ -38,6 +38,11 @@ public class PrivilegedFileReplicator implements FileReplicator, VfsComponent {
private final FileReplicator replicator;
private final VfsComponent replicatorComponent;
+ /**
+ * Constructs a new instance.
+ *
+ * @param replicator The replicator.
+ */
public PrivilegedFileReplicator(final FileReplicator replicator) {
this.replicator = replicator;
if (replicator instanceof VfsComponent) {
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/ProviderConfiguration.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/ProviderConfiguration.java
index 6162e1b..4b89c38 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/ProviderConfiguration.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/ProviderConfiguration.java
@@ -26,37 +26,76 @@ import java.util.List;
* </p>
*/
public class ProviderConfiguration {
+
private String className;
private final List<String> schemes = new ArrayList<>(10);
private final List<String> dependenies = new ArrayList<>(10);
+ /**
+ * Constructs a new instance.
+ */
public ProviderConfiguration() {
}
+ /**
+ * Gets the class name.
+ *
+ * @return the class name.
+ */
public String getClassName() {
return className;
}
+ /**
+ * sets the class name.
+ *
+ * @param className the class name.
+ */
public void setClassName(final String className) {
this.className = className;
}
+ /**
+ * Sets the scheme.
+ *
+ * @param scheme the scheme.
+ */
public void setScheme(final String scheme) {
schemes.add(scheme);
}
+ /**
+ * Gets the schema.
+ *
+ * @return the scheme.
+ */
public List<String> getSchemes() {
return schemes;
}
+ /**
+ * Sets the dependency.
+ *
+ * @param dependency the dependency.
+ */
public void setDependency(final String dependency) {
dependenies.add(dependency);
}
+ /**
+ * Gets the dependency.
+ *
+ * @return the dependency.
+ */
public List<String> getDependencies() {
return dependenies;
}
+ /**
+ * Always returns false.
+ *
+ * @return false.
+ */
public boolean isDefault() {
return false;
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/SynchronizedFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/SynchronizedFileObject.java
index 7a0657f..c9a9b2b 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/SynchronizedFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/SynchronizedFileObject.java
@@ -30,6 +30,11 @@ import org.apache.commons.vfs2.NameScope;
*/
public class SynchronizedFileObject extends DecoratedFileObject {
+ /**
+ * Constructs a new instance.
+ *
+ * @param fileObject The FileObject to decorate.
+ */
public SynchronizedFileObject(final FileObject fileObject) {
super(fileObject);
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VirtualFileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VirtualFileName.java
index da228f4..16a2b33 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VirtualFileName.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VirtualFileName.java
@@ -25,13 +25,20 @@ import org.apache.commons.vfs2.provider.AbstractFileName;
*/
public class VirtualFileName extends AbstractFileName {
- public VirtualFileName(final String scheme, final String absPath, final FileType type) {
- super(scheme, absPath, type);
+ /**
+ * Constructs a new instance.
+ *
+ * @param scheme The scheme.
+ * @param absolutePath the absolute path, maybe empty or null.
+ * @param type the file type.
+ */
+ public VirtualFileName(final String scheme, final String absolutePath, final FileType type) {
+ super(scheme, absolutePath, type);
}
@Override
- public FileName createName(final String absPath, final FileType type) {
- return new VirtualFileName(getScheme(), absPath, type);
+ public FileName createName(final String absolutePath, final FileType type) {
+ return new VirtualFileName(getScheme(), absolutePath, type);
}
@Override
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VirtualFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VirtualFileSystem.java
index d7765a9..777e0be 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VirtualFileSystem.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VirtualFileSystem.java
@@ -40,8 +40,14 @@ import org.apache.commons.vfs2.provider.DelegateFileObject;
public class VirtualFileSystem extends AbstractFileSystem {
private final Map<FileName, FileObject> junctions = new HashMap<>();
- public VirtualFileSystem(final AbstractFileName rootName, final FileSystemOptions fileSystemOptions) {
- super(rootName, null, fileSystemOptions);
+ /**
+ * Constructs a new instance.
+ *
+ * @param rootFileName The root file name of this file system.
+ * @param fileSystemOptions Options to build this file system.
+ */
+ public VirtualFileSystem(final AbstractFileName rootFileName, final FileSystemOptions fileSystemOptions) {
+ super(rootFileName, null, fileSystemOptions);
}
/**
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsStatus.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsStatus.java
index 7d5c9e4..a1c5f2c 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsStatus.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/operations/vcs/VcsStatus.java
@@ -22,9 +22,110 @@ package org.apache.commons.vfs2.operations.vcs;
*/
public enum VcsStatus {
- UNKNOWN(-1), NOT_MODIFIED(0), ADDED(1), CONFLICTED(2), DELETED(3), MERGED(4), IGNORED(5), MODIFIED(6), REPLACED(
- 7), UNVERSIONED(8), MISSING(9), OBSTRUCTED(10), REVERTED(11), RESOLVED(12), COPIED(
- 13), MOVED(14), RESTORED(15), UPDATED(16), EXTERNAL(18), CORRUPTED(19), NOT_REVERTED(20);
+ /**
+ * Unknown.
+ */
+ UNKNOWN(-1),
+
+ /**
+ * Not modified.
+ */
+ NOT_MODIFIED(0),
+
+ /**
+ * Added.
+ */
+ ADDED(1),
+
+ /**
+ * Conflicted.
+ */
+ CONFLICTED(2),
+
+ /**
+ * Deleted.
+ */
+ DELETED(3),
+
+ /**
+ * Merged.
+ */
+ MERGED(4),
+
+ /**
+ * Ignored.
+ */
+ IGNORED(5),
+
+ /**
+ * Modified.
+ */
+ MODIFIED(6),
+
+ /**
+ * Replaced.
+ */
+ REPLACED(7),
+
+ /**
+ * Unversioned.
+ */
+ UNVERSIONED(8),
+
+ /**
+ * Missing.
+ */
+ MISSING(9),
+
+ /**
+ * Obstructed.
+ */
+ OBSTRUCTED(10),
+
+ /**
+ * Reverted.
+ */
+ REVERTED(11),
+
+ /**
+ * Resolved.
+ */
+ RESOLVED(12),
+
+ /**
+ * Copied.
+ */
+ COPIED(13),
+
+ /**
+ * Moved.
+ */
+ MOVED(14),
+
+ /**
+ * Restored.
+ */
+ RESTORED(15),
+
+ /**
+ * Updated.
+ */
+ UPDATED(16),
+
+ /**
+ * External.
+ */
+ EXTERNAL(18),
+
+ /**
+ * Corrupted.
+ */
+ CORRUPTED(19),
+
+ /**
+ * Not reverted.
+ */
+ NOT_REVERTED(20);
private final int status;
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java
index 12dcd97..0d4a01a 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileName.java
@@ -55,16 +55,23 @@ public abstract class AbstractFileName implements FileName {
private String key;
- public AbstractFileName(final String scheme, final String absPath, final FileType type) {
+ /**
+ * Constructs a new instance.
+ *
+ * @param scheme The scheme.
+ * @param absolutePath the absolute path, maybe empty or null.
+ * @param type the file type.
+ */
+ public AbstractFileName(final String scheme, final String absolutePath, final FileType type) {
this.rootUri = null;
this.scheme = scheme;
this.type = type;
- if (StringUtils.isEmpty(absPath)) {
+ if (StringUtils.isEmpty(absolutePath)) {
this.absPath = ROOT_PATH;
- } else if (absPath.length() > 1 && absPath.endsWith("/")) {
- this.absPath = absPath.substring(0, absPath.length() - 1);
+ } else if (absolutePath.length() > 1 && absolutePath.endsWith("/")) {
+ this.absPath = absolutePath.substring(0, absolutePath.length() - 1);
} else {
- this.absPath = absPath;
+ this.absPath = absolutePath;
}
}
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 be699d7..8fb231c 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
@@ -135,13 +135,13 @@ public abstract class AbstractFileObject<AFS extends AbstractFileSystem> impleme
private FileOperations operations;
/**
- *
- * @param name the file name - muse be an instance of {@link AbstractFileName}
- * @param fileSystem the file system
- * @throws ClassCastException if {@code name} is not an instance of {@link AbstractFileName}
+ * Constructs a new instance.
+ *
+ * @param fileName the file name.
+ * @param fileSystem the file system.
*/
- protected AbstractFileObject(final AbstractFileName name, final AFS fileSystem) {
- this.fileName = name;
+ protected AbstractFileObject(final AbstractFileName fileName, final AFS fileSystem) {
+ this.fileName = fileName;
this.fileSystem = fileSystem;
fileSystem.fileObjectHanded(this);
}
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 3c26f10..a13a0da 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
@@ -45,6 +45,9 @@ public abstract class AbstractFileProvider extends AbstractVfsContainer implemen
private FileNameParser parser;
+ /**
+ * Constructs a new instance.
+ */
public AbstractFileProvider() {
parser = GenericFileNameParser.getInstance();
}
@@ -120,7 +123,7 @@ public abstract class AbstractFileProvider extends AbstractVfsContainer implemen
}
/**
- * Returns the FileSystemConfigBuidler.
+ * Gets the FileSystemConfigBuidler.
*
* @return the FileSystemConfigBuilder.
*/
@@ -130,7 +133,7 @@ public abstract class AbstractFileProvider extends AbstractVfsContainer implemen
}
/**
- * Free unused resources.
+ * Frees unused resources.
*/
public void freeUnusedResources() {
final AbstractFileSystem[] abstractFileSystems;
@@ -145,7 +148,7 @@ public abstract class AbstractFileProvider extends AbstractVfsContainer implemen
}
/**
- * Close the FileSystem.
+ * Closes the FileSystem.
*
* @param fileSystem The FileSystem to close.
*/
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 408e5f1..4d14c5f 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
@@ -101,8 +101,14 @@ public abstract class AbstractFileSystem extends AbstractVfsComponent implements
*/
private final AtomicInteger openStreams = new AtomicInteger(0);
- protected AbstractFileSystem(final FileName rootFileName, final FileObject parentLayer,
- final FileSystemOptions fileSystemOptions) {
+ /**
+ * Constructs a new instance.
+ *
+ * @param rootFileName The root file name of this file system.
+ * @param parentLayer The parent layer of this file system.
+ * @param fileSystemOptions Options to build this file system.
+ */
+ protected AbstractFileSystem(final FileName rootFileName, final FileObject parentLayer, final FileSystemOptions fileSystemOptions) {
this.parentLayer = parentLayer;
this.rootName = rootFileName;
this.fileSystemOptions = fileSystemOptions;
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractLayeredFileProvider.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractLayeredFileProvider.java
index d3e32d3..591fb3c 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractLayeredFileProvider.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractLayeredFileProvider.java
@@ -27,6 +27,9 @@ import org.apache.commons.vfs2.FileSystemOptions;
*/
public abstract class AbstractLayeredFileProvider extends AbstractFileProvider {
+ /**
+ * Constructs a new instance.
+ */
public AbstractLayeredFileProvider() {
setFileNameParser(LayeredFileNameParser.getInstance());
}
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 f491667..58f125a 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
@@ -28,6 +28,9 @@ import org.apache.commons.vfs2.FileSystemOptions;
*/
public abstract class AbstractOriginatingFileProvider extends AbstractFileProvider {
+ /**
+ * Constructs a new instance.
+ */
public AbstractOriginatingFileProvider() {
}
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 58fbebb..5d337f9 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
@@ -29,6 +29,9 @@ public abstract class CompositeFileProvider extends AbstractFileProvider {
private static final int INITIAL_BUFSZ = 80;
+ /**
+ * Constructs a new instance.
+ */
public CompositeFileProvider() {
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java
index acda313..7332f66 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultFileContent.java
@@ -71,8 +71,14 @@ public final class DefaultFileContent implements FileContent {
*/
private int openStreams;
- public DefaultFileContent(final AbstractFileObject file, final FileContentInfoFactory fileContentInfoFactory) {
- this.fileObject = file;
+ /**
+ * Constructs a new instance.
+ *
+ * @param fileObject The file object.
+ * @param fileContentInfoFactory The info factory.
+ */
+ public DefaultFileContent(final AbstractFileObject fileObject, final FileContentInfoFactory fileContentInfoFactory) {
+ this.fileObject = fileObject;
this.fileContentInfoFactory = fileContentInfoFactory;
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultURLConnection.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultURLConnection.java
index 5dea39b..557848c 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultURLConnection.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultURLConnection.java
@@ -30,11 +30,17 @@ import org.apache.commons.vfs2.FileSystemException;
*/
public final class DefaultURLConnection extends URLConnection {
- private final FileContent content;
+ private final FileContent fileContent;
- public DefaultURLConnection(final URL url, final FileContent content) {
+ /**
+ * Constructs a new instance.
+ *
+ * @param url The URL to connect.
+ * @param fileContent The URL fileContent.
+ */
+ public DefaultURLConnection(final URL url, final FileContent fileContent) {
super(url);
- this.content = content;
+ this.fileContent = fileContent;
}
@Override
@@ -44,18 +50,18 @@ public final class DefaultURLConnection extends URLConnection {
@Override
public InputStream getInputStream() throws IOException {
- return content.getInputStream();
+ return fileContent.getInputStream();
}
@Override
public OutputStream getOutputStream() throws IOException {
- return content.getOutputStream();
+ return fileContent.getOutputStream();
}
@Override
public long getLastModified() {
try {
- return content.getLastModifiedTime();
+ return fileContent.getLastModifiedTime();
} catch (final FileSystemException ignored) {
return -1; // TODO: report?
}
@@ -64,7 +70,7 @@ public final class DefaultURLConnection extends URLConnection {
@Override
public int getContentLength() {
try {
- return (int) content.getSize();
+ return (int) fileContent.getSize();
} catch (final FileSystemException fse) {
return -1; // TODO: report?
}
@@ -73,7 +79,7 @@ public final class DefaultURLConnection extends URLConnection {
@Override
public String getContentType() {
try {
- return content.getContentInfo().getContentType();
+ return fileContent.getContentInfo().getContentType();
} catch (final FileSystemException e) {
throw new RuntimeException(e.getMessage());
}
@@ -82,7 +88,7 @@ public final class DefaultURLConnection extends URLConnection {
@Override
public String getContentEncoding() {
try {
- return content.getContentInfo().getContentEncoding();
+ return fileContent.getContentInfo().getContentEncoding();
} catch (final FileSystemException e) {
throw new RuntimeException(e.getMessage());
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultURLStreamHandler.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultURLStreamHandler.java
index 19c902d..7ef6d93 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultURLStreamHandler.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DefaultURLStreamHandler.java
@@ -29,13 +29,25 @@ import org.apache.commons.vfs2.FileSystemOptions;
* A default URL stream handler that will work for most file systems.
*/
public class DefaultURLStreamHandler extends URLStreamHandler {
+
private final VfsComponentContext context;
private final FileSystemOptions fileSystemOptions;
+ /**
+ * Constructs a new instance.
+ *
+ * @param context VFS component context.
+ */
public DefaultURLStreamHandler(final VfsComponentContext context) {
this(context, null);
}
+ /**
+ * Constructs a new instance.
+ *
+ * @param context VFS component context.
+ * @param fileSystemOptions FileSystemOptions to resolve files.
+ */
public DefaultURLStreamHandler(final VfsComponentContext context, final FileSystemOptions fileSystemOptions) {
this.context = context;
this.fileSystemOptions = fileSystemOptions;
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DelegateFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DelegateFileObject.java
index 9996554..7619da3 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DelegateFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/DelegateFileObject.java
@@ -45,15 +45,22 @@ import org.apache.commons.vfs2.util.WeakRefFileListener;
*
* @param <AFS> A subclass of AbstractFileSystem.
*/
-public class DelegateFileObject<AFS extends AbstractFileSystem> extends AbstractFileObject<AFS>
- implements FileListener {
+public class DelegateFileObject<AFS extends AbstractFileSystem> extends AbstractFileObject<AFS> implements FileListener {
+
private FileObject file;
private final Set<String> children = new HashSet<>();
private boolean ignoreEvent;
- public DelegateFileObject(final AbstractFileName name, final AFS fileSystem, final FileObject file)
- throws FileSystemException {
- super(name, fileSystem);
+ /**
+ * Constructs a new instance.
+ *
+ * @param fileName the file name.
+ * @param fileSystem the file system.
+ * @param file My file object.
+ * @throws FileSystemException For subclasses to throw.
+ */
+ public DelegateFileObject(final AbstractFileName fileName, final AFS fileSystem, final FileObject file) throws FileSystemException {
+ super(fileName, fileSystem);
this.file = file;
if (file != null) {
WeakRefFileListener.installListener(file, this);
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/LayeredFileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/LayeredFileName.java
index 4544d6d..b1dae5a 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/LayeredFileName.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/LayeredFileName.java
@@ -26,6 +26,14 @@ public class LayeredFileName extends AbstractFileName {
private final FileName outerUri;
+ /**
+ * Constructs a new instance.
+ *
+ * @param scheme The scheme.
+ * @param outerUri outer Uri.
+ * @param path the absolute path, maybe empty or null.
+ * @param type the file type.
+ */
public LayeredFileName(final String scheme, final FileName outerUri, final String path, final FileType type) {
super(scheme, path, type);
this.outerUri = outerUri;
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 52d4e39..f7dfded 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
@@ -57,6 +57,14 @@ public class Bzip2FileObject extends CompressedFileFileObject<Bzip2FileSystem> {
return wrapInputStream(getName().getURI(), getContainer().getContent().getInputStream(bufferSize));
}
+ /**
+ * Wraps an input stream in a compressor input stream.
+ *
+ * @param name Unused.
+ * @param inputStream The input stream to wrap.
+ * @return a new compressor input stream.
+ * @throws IOException if the stream content is malformed or an I/O error occurs.
+ */
public static InputStream wrapInputStream(final String name, final InputStream inputStream) throws IOException {
return new BZip2CompressorInputStream(inputStream);
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/bzip2/Bzip2FileProvider.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/bzip2/Bzip2FileProvider.java
index c5ef559..cf7eb8b 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/bzip2/Bzip2FileProvider.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/bzip2/Bzip2FileProvider.java
@@ -37,6 +37,9 @@ public class Bzip2FileProvider extends CompressedFileFileProvider {
protected static final Collection<Capability> capabilities = Collections.unmodifiableCollection(Arrays.asList(Capability.GET_LAST_MODIFIED, Capability.GET_TYPE, Capability.LIST_CHILDREN, Capability.READ_CONTENT,
Capability.WRITE_CONTENT, Capability.URI, Capability.COMPRESS));
+ /**
+ * Constructs a new instance.
+ */
public Bzip2FileProvider() {
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/compressed/CompressedFileFileProvider.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/compressed/CompressedFileFileProvider.java
index 6b6ebe0..1e3b2a3 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/compressed/CompressedFileFileProvider.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/compressed/CompressedFileFileProvider.java
@@ -33,6 +33,9 @@ import org.apache.commons.vfs2.provider.LayeredFileName;
*/
public abstract class CompressedFileFileProvider extends AbstractLayeredFileProvider {
+ /**
+ * Constructs a new instance.
+ */
public CompressedFileFileProvider() {
}
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFileSystem.java
index 9d1a8f4..06a10a0 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFileSystem.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFileSystem.java
@@ -37,8 +37,15 @@ public class LocalFileSystem extends AbstractFileSystem {
private final String rootFile;
- public LocalFileSystem(final FileName rootName, final String rootFile, final FileSystemOptions opts) {
- super(rootName, null, opts);
+ /**
+ * Constructs a new instance.
+ *
+ * @param rootFileName The root file name of this file system.
+ * @param rootFile The root of this file system.
+ * @param fileSystemOptions Options to build this file system.
+ */
+ public LocalFileSystem(final FileName rootFileName, final String rootFile, final FileSystemOptions fileSystemOptions) {
+ super(rootFileName, null, fileSystemOptions);
this.rootFile = rootFile;
}
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 7ce2351..93115d0 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
@@ -56,9 +56,16 @@ public class ZipFileSystem extends AbstractFileSystem {
*/
private final Map<FileName, FileObject> cache = new HashMap<>();
- public ZipFileSystem(final AbstractFileName rootName, final FileObject parentLayer,
- final FileSystemOptions fileSystemOptions) throws FileSystemException {
- super(rootName, parentLayer, fileSystemOptions);
+ /**
+ * Constructs a new instance.
+ *
+ * @param rootFileName The root file name of this file system.
+ * @param parentLayer The parent layer of this file system.
+ * @param fileSystemOptions Options to build this file system.
+ * @throws FileSystemException If the parent layer does not exist, or on error replicating the file.
+ */
+ public ZipFileSystem(final AbstractFileName rootFileName, final FileObject parentLayer, final FileSystemOptions fileSystemOptions) throws FileSystemException {
+ super(rootFileName, parentLayer, fileSystemOptions);
// Make a local copy of the file
file = parentLayer.getFileSystem().replicateFile(parentLayer, Selectors.SELECT_SELF);
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 55a1fb2..757d547 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
@@ -48,9 +48,7 @@ public class WeakRefFileListener implements FileListener {
* @param listener The FileListener
*/
public static void installListener(final FileObject file, final FileListener listener) {
- final WeakRefFileListener weakListener = new WeakRefFileListener(file, listener);
-
- file.getFileSystem().addListener(file, new WeakRefFileListener(file, weakListener));
+ file.getFileSystem().addListener(file, new WeakRefFileListener(file, new WeakRefFileListener(file, listener)));
}
/**