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/29 19:19:40 UTC
[commons-vfs] branch master updated: Fix Checkstyle issues.
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 f6abf27 Fix Checkstyle issues.
f6abf27 is described below
commit f6abf272a1bd05930b42e8c76c6bf7b2b9f68911
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Nov 29 14:19:35 2021 -0500
Fix Checkstyle issues.
---
checkstyle-suppressions.xml | 15 +++++++++++
.../vfs2/provider/webdav/ExceptionConverter.java | 30 ++++++++++++++++------
.../vfs2/provider/webdav/WebdavFileNameParser.java | 8 ++++++
.../vfs2/provider/webdav/WebdavFileObject.java | 8 +++---
.../vfs2/provider/webdav/WebdavFileProvider.java | 3 +++
.../provider/webdav/WebdavMethodRetryHandler.java | 8 ++++++
.../commons/vfs2/provider/webdav/package-info.java | 2 +-
.../vfs2/provider/webdav4/ExceptionConverter.java | 15 ++++++++---
.../provider/webdav4/Webdav4FileNameParser.java | 8 ++++++
.../vfs2/provider/webdav4/Webdav4FileObject.java | 8 +++---
.../vfs2/provider/webdav4/Webdav4FileProvider.java | 7 +++--
.../vfs2/provider/webdav4/package-info.java | 2 +-
.../provider/webdav4s/Webdav4sFileNameParser.java | 8 ++++++
.../provider/webdav4s/Webdav4sFileProvider.java | 5 +++-
.../vfs2/provider/webdav4s/package-info.java | 2 +-
15 files changed, 103 insertions(+), 26 deletions(-)
diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml
index b281a53..aebc5ce 100644
--- a/checkstyle-suppressions.xml
+++ b/checkstyle-suppressions.xml
@@ -36,4 +36,19 @@
<suppress checks="LineLength" files=".*\.properties"/>
+ <!-- Can't make class final without breaking binary compatibility. -->
+ <suppress checks="FinalClass" files="URIUtils.java"/>
+ <suppress checks="FinalClass" files="ZipFileSystemConfigBuilder.java"/>
+
+ <!-- Can't change method name without breaking binary compatibility. -->
+ <suppress checks="MethodName" files="DefaultFileSystemManager.java" lines="185"/>
+
+ <!-- Use of literals here is reasonable. -->
+ <suppress checks="MagicNumber" files="URIUtils.java" lines="142, 151, 161"/>
+
+ <!-- Use of literals here is reasonable. -->
+ <suppress checks="MagicNumber" files="RamFileRandomAccessContent.java"/>
+
+ <!-- FileSystemOptions is a subclass of Object and uses the copy constructor pattern. -->
+ <suppress checks="SuperClone" files="FileSystemOptions.java"/>
</suppressions>
diff --git a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/ExceptionConverter.java b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/ExceptionConverter.java
index aeef0ce..b0d9eb8 100644
--- a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/ExceptionConverter.java
+++ b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/ExceptionConverter.java
@@ -32,20 +32,34 @@ import org.w3c.dom.Element;
*/
public final class ExceptionConverter {
- // avoid instanciation
+ // avoid instantiation.
private ExceptionConverter() {
}
- public static FileSystemException generate(final DavException davExc) throws FileSystemException {
- return generate(davExc, null);
+ /**
+ * Generates a new instance of FileSystemException.
+ *
+ * @param cause The cause of the new exception.
+ * @return A new FileSystemException.
+ * @throws FileSystemException If an Exception is caught while generating a new instance.
+ */
+ public static FileSystemException generate(final DavException cause) throws FileSystemException {
+ return generate(cause, null);
}
- public static FileSystemException generate(final DavException davExc, final DavMethod method)
- throws FileSystemException {
- String msg = davExc.getMessage();
- if (davExc.hasErrorCondition()) {
+ /**
+ * Generates a new instance of FileSystemException.
+ *
+ * @param cause The cause of the new exception.
+ * @param davMethod Ignored.
+ * @return A new FileSystemException.
+ * @throws FileSystemException If an Exception is caught while generating a new instance.
+ */
+ public static FileSystemException generate(final DavException cause, final DavMethod davMethod) throws FileSystemException {
+ String msg = cause.getMessage();
+ if (cause.hasErrorCondition()) {
try {
- final Element error = davExc.toXml(DomUtil.BUILDER_FACTORY.newDocumentBuilder().newDocument());
+ final Element error = cause.toXml(DomUtil.BUILDER_FACTORY.newDocumentBuilder().newDocument());
if (DomUtil.matches(error, DavException.XML_ERROR, DavConstants.NAMESPACE) && DomUtil.hasChildElement(error, "exception", null)) {
final Element exc = DomUtil.getChildElement(error, "exception", null);
if (DomUtil.hasChildElement(exc, "message", null)) {
diff --git a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileNameParser.java b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileNameParser.java
index a86a8f8..6b87552 100644
--- a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileNameParser.java
+++ b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileNameParser.java
@@ -28,9 +28,17 @@ public class WebdavFileNameParser extends HttpFileNameParser {
private static final WebdavFileNameParser INSTANCE = new WebdavFileNameParser();
+ /**
+ * Constructs a new instance.
+ */
public WebdavFileNameParser() {
}
+ /**
+ * Gets the singleton instance.
+ *
+ * @return the singleton instance.
+ */
public static FileNameParser getInstance() {
return INSTANCE;
}
diff --git a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileObject.java b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileObject.java
index a89cbab..8b6271e 100644
--- a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileObject.java
+++ b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileObject.java
@@ -88,7 +88,7 @@ public class WebdavFileObject extends HttpFileObject<WebdavFileSystem> {
private class WebdavOutputStream extends MonitorOutputStream {
private final WebdavFileObject file;
- public WebdavOutputStream(final WebdavFileObject file) {
+ WebdavOutputStream(final WebdavFileObject file) {
super(new ByteArrayOutputStream());
this.file = file;
}
@@ -211,14 +211,14 @@ public class WebdavFileObject extends HttpFileObject<WebdavFileSystem> {
}
}
+ /** The character set property name. */
+ public static final DavPropertyName RESPONSE_CHARSET = DavPropertyName.create("response-charset");
+
/**
* An empty immutable {@code WebdavFileObject} array.
*/
private static final WebdavFileObject[] EMPTY_ARRAY = {};
- /** The character set property name. */
- public static final DavPropertyName RESPONSE_CHARSET = DavPropertyName.create("response-charset");
-
/** The FileSystemConfigBuilder */
private final WebdavFileSystemConfigBuilder builder;
diff --git a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java
index 2d01afb..2c4eafa 100644
--- a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java
+++ b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java
@@ -57,6 +57,9 @@ public class WebdavFileProvider extends HttpFileProvider {
Capability.GET_LAST_MODIFIED, Capability.ATTRIBUTES, Capability.RANDOM_ACCESS_READ,
Capability.DIRECTORY_READ_CONTENT));
+ /**
+ * Constructs a new instance.
+ */
public WebdavFileProvider() {
setFileNameParser(WebdavFileNameParser.getInstance());
}
diff --git a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavMethodRetryHandler.java b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavMethodRetryHandler.java
index f3703b1..bd9edc8 100644
--- a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavMethodRetryHandler.java
+++ b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavMethodRetryHandler.java
@@ -33,9 +33,17 @@ public final class WebdavMethodRetryHandler implements HttpMethodRetryHandler {
private static final WebdavMethodRetryHandler INSTANCE = new WebdavMethodRetryHandler();
+ /**
+ * Constructs a new instance.
+ */
private WebdavMethodRetryHandler() {
}
+ /**
+ * Gets the singleton instance.
+ *
+ * @return the singleton instance.
+ */
public static WebdavMethodRetryHandler getInstance() {
return INSTANCE;
}
diff --git a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/package-info.java b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/package-info.java
index 0c4a2fd..c1ee92c 100644
--- a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/package-info.java
+++ b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/package-info.java
@@ -16,6 +16,6 @@
*/
/**
- * The WebDAV File Provider
+ * The WebDAV File Provider.
*/
package org.apache.commons.vfs2.provider.webdav;
diff --git a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/ExceptionConverter.java b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/ExceptionConverter.java
index fef9f2a..eadae01 100644
--- a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/ExceptionConverter.java
+++ b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/ExceptionConverter.java
@@ -35,11 +35,18 @@ public final class ExceptionConverter {
private ExceptionConverter() {
}
- public static FileSystemException generate(final DavException davExc) throws FileSystemException {
- String msg = davExc.getMessage();
- if (davExc.hasErrorCondition()) {
+ /**
+ * Generates a new instance of FileSystemException.
+ *
+ * @param cause The cause of the new exception.
+ * @return A new FileSystemException.
+ * @throws FileSystemException If an Exception is caught while generating a new instance.
+ */
+ public static FileSystemException generate(final DavException cause) throws FileSystemException {
+ String msg = cause.getMessage();
+ if (cause.hasErrorCondition()) {
try {
- final Element error = davExc.toXml(DomUtil.createDocument());
+ final Element error = cause.toXml(DomUtil.createDocument());
if (DomUtil.matches(error, DavException.XML_ERROR, DavConstants.NAMESPACE) && DomUtil.hasChildElement(error, "exception", null)) {
final Element exc = DomUtil.getChildElement(error, "exception", null);
if (DomUtil.hasChildElement(exc, "message", null)) {
diff --git a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileNameParser.java b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileNameParser.java
index 666720b..01dc17f 100644
--- a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileNameParser.java
+++ b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileNameParser.java
@@ -27,9 +27,17 @@ import org.apache.commons.vfs2.provider.http4.Http4FileNameParser;
public class Webdav4FileNameParser extends Http4FileNameParser {
private static final Webdav4FileNameParser INSTANCE = new Webdav4FileNameParser();
+ /**
+ * Constructs a new instance.
+ */
public Webdav4FileNameParser() {
}
+ /**
+ * Gets the singleton instance.
+ *
+ * @return the singleton instance.
+ */
public static FileNameParser getInstance() {
return INSTANCE;
}
diff --git a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileObject.java b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileObject.java
index 4345cd3..acc3351 100644
--- a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileObject.java
+++ b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileObject.java
@@ -87,7 +87,7 @@ public class Webdav4FileObject extends Http4FileObject<Webdav4FileSystem> {
private class WebdavOutputStream extends MonitorOutputStream {
private final Webdav4FileObject file;
- public WebdavOutputStream(final Webdav4FileObject file) {
+ WebdavOutputStream(final Webdav4FileObject file) {
super(new ByteArrayOutputStream());
this.file = file;
}
@@ -211,14 +211,14 @@ public class Webdav4FileObject extends Http4FileObject<Webdav4FileSystem> {
}
}
+ /** The character set property name. */
+ public static final DavPropertyName RESPONSE_CHARSET = DavPropertyName.create("response-charset");
+
/**
* An empty immutable {@code Webdav4FileObject} array.
*/
private static final Webdav4FileObject[] EMPTY_ARRAY = {};
- /** The character set property name. */
- public static final DavPropertyName RESPONSE_CHARSET = DavPropertyName.create("response-charset");
-
/** The FileSystemConfigBuilder */
private final Webdav4FileSystemConfigBuilder builder;
diff --git a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileProvider.java b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileProvider.java
index 7397f20..59afdfa 100644
--- a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileProvider.java
+++ b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileProvider.java
@@ -50,7 +50,7 @@ public class Webdav4FileProvider extends Http4FileProvider {
public static final UserAuthenticationData.Type[] AUTHENTICATOR_TYPES = {
UserAuthenticationData.USERNAME, UserAuthenticationData.PASSWORD };
- /** The capabilities of the WebDAV provider */
+ /** The capabilities of the WebDAV provider. */
public static final Collection<Capability> DEFAULT_CAPABILITIES =
Collections.unmodifiableCollection(
Arrays.asList(
@@ -69,9 +69,12 @@ public class Webdav4FileProvider extends Http4FileProvider {
)
);
- /** The capabilities of the WebDAV provider */
+ /** The capabilities of the WebDAV provider. */
protected static final Collection<Capability> capabilities = DEFAULT_CAPABILITIES;
+ /**
+ * Constructs a new instance.
+ */
public Webdav4FileProvider() {
setFileNameParser(Webdav4FileNameParser.getInstance());
}
diff --git a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/package-info.java b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/package-info.java
index 5b4c057..98fd920 100644
--- a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/package-info.java
+++ b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/package-info.java
@@ -16,6 +16,6 @@
*/
/**
- * The WebDAV Provider based on HTTP4 File Provider
+ * The WebDAV Provider based on HTTP4 File Provider.
*/
package org.apache.commons.vfs2.provider.webdav4;
diff --git a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4s/Webdav4sFileNameParser.java b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4s/Webdav4sFileNameParser.java
index f826811..de764f1 100644
--- a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4s/Webdav4sFileNameParser.java
+++ b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4s/Webdav4sFileNameParser.java
@@ -28,9 +28,17 @@ public class Webdav4sFileNameParser extends Http4sFileNameParser {
private static final Webdav4sFileNameParser INSTANCE = new Webdav4sFileNameParser();
+ /**
+ * Constructs a new instance.
+ */
public Webdav4sFileNameParser() {
}
+ /**
+ * Gets the singleton instance.
+ *
+ * @return the singleton instance.
+ */
public static FileNameParser getInstance() {
return INSTANCE;
}
diff --git a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4s/Webdav4sFileProvider.java b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4s/Webdav4sFileProvider.java
index bcb973f..7754be9 100644
--- a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4s/Webdav4sFileProvider.java
+++ b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4s/Webdav4sFileProvider.java
@@ -42,9 +42,12 @@ import org.apache.http.client.protocol.HttpClientContext;
*/
public class Webdav4sFileProvider extends Http4sFileProvider {
- /** The capabilities of the WebDAV provider */
+ /** The capabilities of the WebDAV provider. */
protected static final Collection<Capability> capabilities = Webdav4FileProvider.DEFAULT_CAPABILITIES;
+ /**
+ * Constructs a new instance.
+ */
public Webdav4sFileProvider() {
setFileNameParser(Webdav4sFileNameParser.getInstance());
}
diff --git a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4s/package-info.java b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4s/package-info.java
index 3871351..c9c9ed3 100644
--- a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4s/package-info.java
+++ b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4s/package-info.java
@@ -16,6 +16,6 @@
*/
/**
- * The WebDAV Provider based on HTTP4S File Provider
+ * The WebDAV Provider based on HTTP4S File Provider.
*/
package org.apache.commons.vfs2.provider.webdav4s;