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 2024/08/12 11:54:34 UTC
(commons-vfs) 01/02: org.apache.commons.vfs2.provider.http.HttpFileObject.doListChildren() now throws UnsupportedOperationException instead of Exception
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 d841d6ee530519491e3d94e4cc1259fe3b930820
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Aug 12 07:52:18 2024 -0400
org.apache.commons.vfs2.provider.http.HttpFileObject.doListChildren()
now throws UnsupportedOperationException instead of Exception
---
.../commons/vfs2/provider/http/HttpFileObject.java | 45 +++++++++++++++++++---
src/changes/changes.xml | 3 ++
2 files changed, 43 insertions(+), 5 deletions(-)
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java
index f4c192bd..de1060c7 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java
@@ -198,28 +198,53 @@ public class HttpFileObject<FS extends HttpFileSystem> extends AbstractFileObjec
}
/**
- * Lists the children of this file.
+ * Throws UnsupportedOperationException.
+ *
+ * @throws UnsupportedOperationException always thrown.
*/
@Override
protected String[] doListChildren() throws Exception {
- throw new Exception("Not implemented.");
+ throw new UnsupportedOperationException("Not implemented.");
}
- protected String encodePath(final String decodedPath) throws URIException {
- return URIUtil.encodePath(decodedPath);
+ /**
+ * Encodes the given path.
+ *
+ * @param unescaped An unescaped path.
+ * @return the encoded path.
+ * @throws URIException if the default protocol charset is not supported
+ */
+ protected String encodePath(final String unescaped) throws URIException {
+ return URIUtil.encodePath(unescaped);
}
+ /**
+ * Gets a new FileContentInfoFactory.
+ *
+ * @return a new FileContentInfoFactory.
+ */
@Override
protected FileContentInfoFactory getFileContentInfoFactory() {
return new HttpFileContentInfoFactory();
}
+ /**
+ * Gets whether to follow redirects.
+ *
+ * @return whether to follow redirects.
+ */
protected boolean getFollowRedirect() {
return followRedirect;
}
+ /**
+ * Gets a new HeadMethod.
+ *
+ * @return a new HeadMethod.
+ * @throws IOException if an IO error occurs.
+ */
HeadMethod getHeadMethod() throws IOException {
- // need to synchronize on the filesystem as the detach method will clear out "method"
+ // need to synchronize on the file system as the detach method will clear out "method"
synchronized (getFileSystem()) {
if (method != null) {
return method;
@@ -236,10 +261,20 @@ public class HttpFileObject<FS extends HttpFileSystem> extends AbstractFileObjec
}
}
+ /**
+ * Gets the URL charset name.
+ *
+ * @return the URL charset name.
+ */
protected String getUrlCharset() {
return urlCharset;
}
+ /**
+ * Gets the user agent.
+ *
+ * @return the user agent.
+ */
protected String getUserAgent() {
return userAgent;
}
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 7ec1e0f9..855b4c9d 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -203,6 +203,9 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" dev="ggregory" due-to="Gary Gregory">
ZipFileSystemConfigBuilder.getCharset(FileSystemOptions) returns UTF-8 instead of null when absent.
</action>
+ <action type="fix" dev="ggregory" due-to="Gary Gregory">
+ org.apache.commons.vfs2.provider.http.HttpFileObject.doListChildren() now throws UnsupportedOperationException instead of Exception.
+ </action>
<!-- ADD -->
<action type="add" issue="VFS-848" dev="ggregory" due-to="beise, Gary Gregory">
Config option for trailing slash in webdav URI #425.