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 2020/09/23 14:13:47 UTC

[commons-vfs] 03/03: Drop some unused exceptions from throws clauses (this does not break binary compatibility).

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 e7e47f80900570fdbc26d3fc9a25713fc3afdd30
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Sep 23 10:13:38 2020 -0400

    Drop some unused exceptions from throws clauses (this does not break
    binary compatibility).
---
 .../apache/commons/vfs2/provider/webdav4/Webdav4FileObject.java  | 7 +++----
 .../vfs2/provider/webdav4/test/Webdav4ProviderTestCase.java      | 6 ++----
 .../org/apache/commons/vfs2/provider/GenericURLFileName.java     | 6 ++----
 .../org/apache/commons/vfs2/provider/http4/Http4FileObject.java  | 6 ++----
 .../org/apache/commons/vfs2/provider/http5/Http5FileObject.java  | 6 ++----
 .../src/main/java/org/apache/commons/vfs2/util/URIUtils.java     | 9 ++-------
 6 files changed, 13 insertions(+), 27 deletions(-)

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 b74cc23..824c8a4 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
@@ -20,7 +20,6 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.net.HttpURLConnection;
-import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -220,12 +219,12 @@ public class Webdav4FileObject extends Http4FileObject<Webdav4FileSystem> {
     private final Webdav4FileSystem fileSystem;
 
     protected Webdav4FileObject(final AbstractFileName name, final Webdav4FileSystem fileSystem)
-            throws FileSystemException, URISyntaxException {
+            throws FileSystemException {
         this(name, fileSystem, Webdav4FileSystemConfigBuilder.getInstance());
     }
 
     protected Webdav4FileObject(final AbstractFileName name, final Webdav4FileSystem fileSystem,
-            final Webdav4FileSystemConfigBuilder builder) throws FileSystemException, URISyntaxException {
+            final Webdav4FileSystemConfigBuilder builder) throws FileSystemException {
         super(name, fileSystem, builder);
         this.fileSystem = fileSystem;
         this.builder = builder;
@@ -588,7 +587,7 @@ public class Webdav4FileObject extends Http4FileObject<Webdav4FileSystem> {
         return i >= 0 ? path.substring(i + 1) : path;
     }
 
-    private void setupRequest(final HttpUriRequest request) throws FileSystemException {
+    private void setupRequest(final HttpUriRequest request) {
         // NOTE: *FileSystemConfigBuilder takes care of redirect option and user agent.
         request.addHeader("Cache-control", "no-cache");
         request.addHeader("Cache-store", "no-store");
diff --git a/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/Webdav4ProviderTestCase.java b/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/Webdav4ProviderTestCase.java
index 279b2fc..9d7fd07 100644
--- a/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/Webdav4ProviderTestCase.java
+++ b/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/Webdav4ProviderTestCase.java
@@ -153,7 +153,7 @@ public class Webdav4ProviderTestCase extends AbstractProviderTestConfig {
         return System.getProperty(TEST_URI);
     }
 
-    private static TransientRepository getTransientRepository(final File repoDirectory) throws IOException {
+    private static TransientRepository getTransientRepository(final File repoDirectory) {
         return new TransientRepository(new File(repoDirectory, "repository.xml"), repoDirectory);
     }
 
@@ -270,10 +270,8 @@ public class Webdav4ProviderTestCase extends AbstractProviderTestConfig {
      * <li>Remove temporary repository directory.</li>
      * </ol>
      * Stops the embedded Apache WebDAV Server.
-     *
-     * @throws Exception @throws
      */
-    private static void tearDownClass() throws Exception {
+    private static void tearDownClass() {
         // Stop Jackrabbit Main for graceful shutdown
         jrMain.shutdown();
 
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/GenericURLFileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/GenericURLFileName.java
index 7216aaa..a5526e7 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/GenericURLFileName.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/GenericURLFileName.java
@@ -67,10 +67,9 @@ public class GenericURLFileName extends GenericFileName {
      *
      * @param charset the charset used for the path encoding
      * @return The encoded path.
-     * @throws URISyntaxException If an error occurs encoding the URI.
      * @throws FileSystemException If some other error occurs.
      */
-    public String getPathQueryEncoded(final String charset) throws URISyntaxException, FileSystemException {
+    public String getPathQueryEncoded(final String charset) throws FileSystemException {
         if (getQueryString() == null) {
             if (charset != null) {
                 return URIUtils.encodePath(getPathDecoded(), charset);
@@ -128,9 +127,8 @@ public class GenericURLFileName extends GenericFileName {
      * @param charset The character set.
      * @return The encoded URI
      * @throws FileSystemException if some other exception occurs.
-     * @throws URISyntaxException if an exception occurs encoding the URI.
      */
-    public String getURIEncoded(final String charset) throws FileSystemException, URISyntaxException {
+    public String getURIEncoded(final String charset) throws FileSystemException {
         final StringBuilder sb = new StringBuilder(BUFFER_SIZE);
         appendRootUri(sb, true);
         sb.append(getPathQueryEncoded(charset));
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileObject.java
index 4e6049f..05e5356 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileObject.java
@@ -74,10 +74,9 @@ public class Http4FileObject<FS extends Http4FileSystem> extends AbstractFileObj
      * @param name file name
      * @param fileSystem file system
      * @throws FileSystemException if any error occurs
-     * @throws URISyntaxException if given file name cannot be converted to a URI due to URI syntax error
      */
     protected Http4FileObject(final AbstractFileName name, final FS fileSystem)
-            throws FileSystemException, URISyntaxException {
+            throws FileSystemException {
         this(name, fileSystem, Http4FileSystemConfigBuilder.getInstance());
     }
 
@@ -88,10 +87,9 @@ public class Http4FileObject<FS extends Http4FileSystem> extends AbstractFileObj
      * @param fileSystem file system
      * @param builder {@code Http4FileSystemConfigBuilder} object
      * @throws FileSystemException if any error occurs
-     * @throws URISyntaxException if given file name cannot be converted to a URI due to URI syntax error
      */
     protected Http4FileObject(final AbstractFileName name, final FS fileSystem,
-            final Http4FileSystemConfigBuilder builder) throws FileSystemException, URISyntaxException {
+            final Http4FileSystemConfigBuilder builder) throws FileSystemException {
         super(name, fileSystem);
         final FileSystemOptions fileSystemOptions = fileSystem.getFileSystemOptions();
         urlCharset = builder.getUrlCharset(fileSystemOptions);
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileObject.java
index a48891d..30b7f80 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileObject.java
@@ -75,10 +75,9 @@ public class Http5FileObject<FS extends Http5FileSystem> extends AbstractFileObj
      * @param name file name
      * @param fileSystem file system
      * @throws FileSystemException if any error occurs
-     * @throws URISyntaxException if given file name cannot be converted to a URI due to URI syntax error
      */
     protected Http5FileObject(final AbstractFileName name, final FS fileSystem)
-            throws FileSystemException, URISyntaxException {
+            throws FileSystemException {
         this(name, fileSystem, Http5FileSystemConfigBuilder.getInstance());
     }
 
@@ -89,10 +88,9 @@ public class Http5FileObject<FS extends Http5FileSystem> extends AbstractFileObj
      * @param fileSystem file system
      * @param builder {@code Http4FileSystemConfigBuilder} object
      * @throws FileSystemException if any error occurs
-     * @throws URISyntaxException if given file name cannot be converted to a URI due to URI syntax error
      */
     protected Http5FileObject(final AbstractFileName name, final FS fileSystem,
-            final Http5FileSystemConfigBuilder builder) throws FileSystemException, URISyntaxException {
+            final Http5FileSystemConfigBuilder builder) throws FileSystemException {
         super(name, fileSystem);
         final FileSystemOptions fileSystemOptions = fileSystem.getFileSystemOptions();
         urlCharset = builder.getUrlCharset(fileSystemOptions);
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 bb3b528..76779f0 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
@@ -18,7 +18,6 @@ package org.apache.commons.vfs2.util;
 
 import java.io.ByteArrayOutputStream;
 import java.io.UnsupportedEncodingException;
-import java.net.URISyntaxException;
 import java.util.BitSet;
 
 import org.apache.commons.logging.Log;
@@ -194,10 +193,8 @@ public class URIUtils {
      *
      * @param unescaped an unescaped string
      * @return the escaped string
-     *
-     * @throws URISyntaxException not thrown but kept for source compatibility
      */
-    public static String encodePath(final String unescaped) throws URISyntaxException {
+    public static String encodePath(final String unescaped) {
         return encodePath(unescaped, DEFAULT_PROTOCOL_CHARSET);
     }
 
@@ -208,10 +205,8 @@ public class URIUtils {
      * @param unescaped an unescaped string
      * @param charset the charset
      * @return the escaped string
-     *
-     * @throws URISyntaxException not thrown but kept for source compatibility
      */
-    public static String encodePath(final String unescaped, final String charset) throws URISyntaxException {
+    public static String encodePath(final String unescaped, final String charset) {
         if (unescaped == null) {
             throw new IllegalArgumentException("The string to encode may not be null.");
         }