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 2023/06/23 20:27:07 UTC

[commons-vfs] branch master updated (31cc52b1 -> 3bfae6ab)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git


    from 31cc52b1 Bump commons-codec:commons-codec: from 1.15 to 1.16.0
     new 7ab04ec2 [impl] Throw a specialized RuntimeException instead of RuntimeException
     new da7c04b9 [ftp] Throw a specialized RuntimeException instead of RuntimeException
     new 18add712 [hdfs] Throw a specialized RuntimeException instead of RuntimeException
     new dc7019b5 [http4] Throw a specialized RuntimeException instead of RuntimeException
     new 974fabbe [http5] Throw a specialized RuntimeException instead of RuntimeException
     new f0ab7c1e [local] Throw a specialized RuntimeException instead of RuntimeException
     new 15441ed0 [zip] Throw a specialized RuntimeException instead of RuntimeException
     new dda67644 [zip] Throw a specialized RuntimeException instead of RuntimeException
     new 14426c16 [provider] Throw a specialized RuntimeException instead of RuntimeException
     new 31f5fa5e [util] Throw a specialized RuntimeException instead of RuntimeException
     new 2228fd51 [filter] Throw a specialized RuntimeException instead of RuntimeException
     new f40b1c7e [impl] Throw a specialized RuntimeException instead of RuntimeException
     new 49fc64ed [hdfs] Throw a specialized RuntimeException instead of RuntimeException
     new 1562bc94 [test] Throw a specialized RuntimeException instead of RuntimeException
     new 3bfae6ab Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-vfs.git

The 15 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/commons/vfs2/impl/URLStreamHandlerProxy.java    |  4 ++--
 .../org/apache/commons/vfs2/provider/AbstractFileObject.java   |  3 ++-
 .../org/apache/commons/vfs2/provider/AbstractFileSystem.java   |  7 ++-----
 .../org/apache/commons/vfs2/provider/DefaultURLConnection.java |  7 ++++---
 .../apache/commons/vfs2/provider/DefaultURLStreamHandler.java  |  3 ++-
 .../org/apache/commons/vfs2/provider/ftp/FtpFileObject.java    |  3 ++-
 .../org/apache/commons/vfs2/provider/hdfs/HdfsFileSystem.java  |  3 ++-
 .../apache/commons/vfs2/provider/http4/Http4FileSystem.java    |  3 ++-
 .../apache/commons/vfs2/provider/http5/Http5FileSystem.java    |  3 ++-
 .../java/org/apache/commons/vfs2/provider/local/LocalFile.java | 10 +++-------
 .../org/apache/commons/vfs2/provider/tar/TarFileObject.java    |  3 ++-
 .../org/apache/commons/vfs2/provider/zip/ZipFileObject.java    |  3 ++-
 .../main/java/org/apache/commons/vfs2/util/CryptorFactory.java |  2 +-
 .../src/test/java/org/apache/commons/vfs2/RunTest.java         |  4 ++--
 .../java/org/apache/commons/vfs2/filter/BaseFilterTest.java    |  5 +++--
 .../java/org/apache/commons/vfs2/impl/VfsClassLoaderTests.java |  4 ++--
 .../commons/vfs2/provider/hdfs/HdfsFileProviderTest.java       |  2 +-
 .../commons/vfs2/provider/hdfs/HdfsFileProviderTestCase.java   |  3 ++-
 18 files changed, 38 insertions(+), 34 deletions(-)


[commons-vfs] 04/15: [http4] Throw a specialized RuntimeException instead of RuntimeException

Posted by gg...@apache.org.
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 dc7019b52d536f24a8ec796566147ee0a654cc9f
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 16:24:42 2023 -0400

    [http4] Throw a specialized RuntimeException instead of
    RuntimeException
---
 .../java/org/apache/commons/vfs2/provider/http4/Http4FileSystem.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileSystem.java
index 85aa472b..188ddb69 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileSystem.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileSystem.java
@@ -17,6 +17,7 @@
 package org.apache.commons.vfs2.provider.http4;
 
 import java.io.IOException;
+import java.io.UncheckedIOException;
 import java.net.URI;
 import java.util.Collection;
 
@@ -91,7 +92,7 @@ public class Http4FileSystem extends AbstractFileSystem {
             try {
                 ((CloseableHttpClient) httpClient).close();
             } catch (final IOException e) {
-                throw new RuntimeException("Error closing HttpClient", e);
+                throw new UncheckedIOException("Error closing HttpClient", e);
             }
         }
     }


[commons-vfs] 03/15: [hdfs] Throw a specialized RuntimeException instead of RuntimeException

Posted by gg...@apache.org.
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 18add71266c289bac70b8e06df22205581d07842
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 16:24:31 2023 -0400

    [hdfs] Throw a specialized RuntimeException instead of
    RuntimeException
---
 .../java/org/apache/commons/vfs2/provider/hdfs/HdfsFileSystem.java     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileSystem.java
index e141e92c..c4df7c0b 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileSystem.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileSystem.java
@@ -18,6 +18,7 @@ package org.apache.commons.vfs2.provider.hdfs;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.UncheckedIOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URL;
 import java.net.URLDecoder;
@@ -76,7 +77,7 @@ public class HdfsFileSystem extends AbstractFileSystem {
                 fs.close();
             }
         } catch (final IOException e) {
-            throw new RuntimeException("Error closing HDFS client", e);
+            throw new UncheckedIOException("Error closing HDFS client", e);
         }
         super.close();
     }


[commons-vfs] 01/15: [impl] Throw a specialized RuntimeException instead of RuntimeException

Posted by gg...@apache.org.
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 7ab04ec2566df73cb4a58c933a161d692fda6eae
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 16:24:02 2023 -0400

    [impl] Throw a specialized RuntimeException instead of
    RuntimeException
---
 .../main/java/org/apache/commons/vfs2/impl/URLStreamHandlerProxy.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/URLStreamHandlerProxy.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/URLStreamHandlerProxy.java
index acde392c..a0cef7d8 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/URLStreamHandlerProxy.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/URLStreamHandlerProxy.java
@@ -39,9 +39,9 @@ final class URLStreamHandlerProxy extends URLStreamHandler {
             setURL(u, url.getProtocol(), url.getHost(), url.getPort(), url.getAuthority(), url.getUserInfo(),
                     url.getFile(), url.getQuery(), url.getRef());
         } catch (final MalformedURLException mue) {
-            // We rethrow this as a simple runtime exception.
+            // We rethrow this as a runtime exception.
             // It is rethrown in URL as a MalformedURLException anyway.
-            throw new RuntimeException(mue.getMessage());
+            throw new IllegalArgumentException(mue.getMessage());
         }
     }
 }


[commons-vfs] 02/15: [ftp] Throw a specialized RuntimeException instead of RuntimeException

Posted by gg...@apache.org.
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 da7c04b9e669f4edf4c50fea0821bdbe55ddceb9
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 16:24:14 2023 -0400

    [ftp] Throw a specialized RuntimeException instead of
    RuntimeException
---
 .../main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java
index 47f51890..fa81274f 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java
@@ -20,6 +20,7 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.UncheckedIOException;
 import java.time.Instant;
 import java.util.Calendar;
 import java.util.Collections;
@@ -596,7 +597,7 @@ public class FtpFileObject extends AbstractFileObject<FtpFileSystem> {
             try {
                 childMap.remove(UriParser.decode(child.getBaseName()));
             } catch (final FileSystemException e) {
-                throw new RuntimeException(e.getMessage());
+                throw new UncheckedIOException(e);
             }
         } else {
             // if child was added we have to rescan the children


[commons-vfs] 13/15: [hdfs] Throw a specialized RuntimeException instead of RuntimeException

Posted by gg...@apache.org.
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 49fc64ed628301b9748e956831aeb1451d52c776
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 16:26:15 2023 -0400

    [hdfs] Throw a specialized RuntimeException instead of
    RuntimeException
---
 .../org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTest.java    | 2 +-
 .../apache/commons/vfs2/provider/hdfs/HdfsFileProviderTestCase.java    | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTest.java
index 7a02222c..ad6d8e36 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTest.java
@@ -99,7 +99,7 @@ public class HdfsFileProviderTest {
             final int newPermission = 0777 ^ umask;
             conf2.set("dfs.datanode.data.dir.perm", String.format("%03o", newPermission));
         } catch (final Exception e) {
-            throw new RuntimeException("Error getting umask from O/S", e);
+            throw new IllegalStateException("Error getting umask from O/S", e);
         }
     }
 
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTestCase.java
index 8dee5b0b..7e8b9e4a 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileProviderTestCase.java
@@ -20,6 +20,7 @@ import static org.apache.commons.vfs2.VfsTestUtils.getTestDirectoryFile;
 
 import java.io.File;
 import java.io.IOException;
+import java.io.UncheckedIOException;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.vfs2.AbstractProviderTestConfig;
@@ -99,7 +100,7 @@ public class HdfsFileProviderTestCase extends AbstractProviderTestConfig {
                 cluster = new MiniDFSCluster(PORT, conf, 1, true, true, true, null, null, null, null);
                 cluster.waitActive();
             } catch (final IOException e) {
-                throw new RuntimeException("Error setting up mini cluster", e);
+                throw new UncheckedIOException("Error setting up mini cluster", e);
             }
             hdfs = cluster.getFileSystem();
 


[commons-vfs] 10/15: [util] Throw a specialized RuntimeException instead of RuntimeException

Posted by gg...@apache.org.
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 31f5fa5e8aec76761e89475858c00ab3f2922cdb
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 16:25:42 2023 -0400

    [util] Throw a specialized RuntimeException instead of
    RuntimeException
---
 .../src/main/java/org/apache/commons/vfs2/util/CryptorFactory.java      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/CryptorFactory.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/CryptorFactory.java
index 0bd34a46..0d2bd94f 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/CryptorFactory.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/CryptorFactory.java
@@ -55,7 +55,7 @@ public final class CryptorFactory {
                 instance = (Cryptor) clazz.newInstance();
                 return instance;
             } catch (final Exception ex) {
-                throw new RuntimeException("Unable to create Cryptor " + cryptorClass, ex);
+                throw new IllegalStateException("Unable to create Cryptor " + cryptorClass, ex);
             }
         }
         instance = new DefaultCryptor();


[commons-vfs] 07/15: [zip] Throw a specialized RuntimeException instead of RuntimeException

Posted by gg...@apache.org.
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 15441ed0fd1d4a9a6d970f8bcf4a4c526519d521
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 16:25:14 2023 -0400

    [zip] Throw a specialized RuntimeException instead of
    RuntimeException
---
 .../main/java/org/apache/commons/vfs2/provider/tar/TarFileObject.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileObject.java
index 0cf01be4..620ae034 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileObject.java
@@ -17,6 +17,7 @@
 package org.apache.commons.vfs2.provider.tar;
 
 import java.io.InputStream;
+import java.io.UncheckedIOException;
 import java.util.HashSet;
 
 import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
@@ -116,7 +117,7 @@ public class TarFileObject extends AbstractFileObject<TarFileSystem> {
             }
         } catch (final FileSystemException e) {
             // should not happen as the type has already been cached.
-            throw new RuntimeException(e);
+            throw new UncheckedIOException(e);
         }
 
         return children.toArray(ArrayUtils.EMPTY_STRING_ARRAY);


[commons-vfs] 09/15: [provider] Throw a specialized RuntimeException instead of RuntimeException

Posted by gg...@apache.org.
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 14426c160549a2f52dafeb7284ad276118b3373c
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 16:25:33 2023 -0400

    [provider] Throw a specialized RuntimeException instead of
    RuntimeException
---
 .../java/org/apache/commons/vfs2/provider/AbstractFileObject.java  | 3 ++-
 .../java/org/apache/commons/vfs2/provider/AbstractFileSystem.java  | 7 ++-----
 .../org/apache/commons/vfs2/provider/DefaultURLConnection.java     | 7 ++++---
 .../org/apache/commons/vfs2/provider/DefaultURLStreamHandler.java  | 3 ++-
 4 files changed, 10 insertions(+), 10 deletions(-)

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 68c86f38..eb8981da 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
@@ -21,6 +21,7 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.UncheckedIOException;
 import java.net.URL;
 import java.security.AccessController;
 import java.security.PrivilegedActionException;
@@ -1864,7 +1865,7 @@ public abstract class AbstractFileObject<AFS extends AbstractFileSystem> impleme
             try {
                 fileName.setType(type);
             } catch (final FileSystemException e) {
-                throw new RuntimeException(e.getMessage());
+                throw new UncheckedIOException(e);
             }
         }
         this.type = type;
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 b42ef2f1..3045b332 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
@@ -23,6 +23,7 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
+import java.util.Objects;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
@@ -315,11 +316,7 @@ public abstract class AbstractFileSystem extends AbstractVfsComponent implements
 
     private FilesCache getFilesCache() {
         final FilesCache filesCache = getContext().getFileSystemManager().getFilesCache();
-        if (filesCache == null) {
-            throw new RuntimeException(Messages.getString("vfs.provider/files-cache-missing.error"));
-        }
-
-        return filesCache;
+        return Objects.requireNonNull(filesCache, () -> Messages.getString("vfs.provider/files-cache-missing.error"));
     }
 
     /**
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 f6deecac..ad10f764 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
@@ -19,6 +19,7 @@ package org.apache.commons.vfs2.provider;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.UncheckedIOException;
 import java.net.URL;
 import java.net.URLConnection;
 
@@ -53,7 +54,7 @@ public final class DefaultURLConnection extends URLConnection {
         try {
             return fileContent.getContentInfo().getContentEncoding();
         } catch (final FileSystemException e) {
-            throw new RuntimeException(e.getMessage());
+            throw new UncheckedIOException(e);
         }
     }
 
@@ -71,7 +72,7 @@ public final class DefaultURLConnection extends URLConnection {
         try {
             return fileContent.getContentInfo().getContentType();
         } catch (final FileSystemException e) {
-            throw new RuntimeException(e.getMessage());
+            throw new UncheckedIOException(e);
         }
     }
 
@@ -99,6 +100,6 @@ public final class DefaultURLConnection extends URLConnection {
      * (content.getFile().getFileSystem().hasCapability(Capability.ATTRIBUTES)) { String value = (String)
      * content.getAttribute(name); if (value != null) { return value; } }
      *
-     * return null; } catch (FileSystemException e) { throw new RuntimeException(e); } }
+     * return null; } catch (FileSystemException e) { throw new UncheckedIOException(e); } }
      */
 }
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 7ef6d93b..41a1b374 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
@@ -17,6 +17,7 @@
 package org.apache.commons.vfs2.provider;
 
 import java.io.IOException;
+import java.io.UncheckedIOException;
 import java.net.URL;
 import java.net.URLConnection;
 import java.net.URLStreamHandler;
@@ -81,7 +82,7 @@ public class DefaultURLStreamHandler extends URLStreamHandler {
             setURL(u, protocolPart, "", -1, null, null, filePart.toString(), null, null);
         } catch (final FileSystemException fse) {
             // This is rethrown to MalformedURLException in URL anyway
-            throw new RuntimeException(fse.getMessage());
+            throw new UncheckedIOException(fse);
         }
     }
 


[commons-vfs] 12/15: [impl] Throw a specialized RuntimeException instead of RuntimeException

Posted by gg...@apache.org.
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 f40b1c7e1498ff758d3a7df6833fcc080b2fb9c1
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 16:26:04 2023 -0400

    [impl] Throw a specialized RuntimeException instead of
    RuntimeException
---
 .../test/java/org/apache/commons/vfs2/impl/VfsClassLoaderTests.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/VfsClassLoaderTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/VfsClassLoaderTests.java
index 533ba676..cee9f8e9 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/VfsClassLoaderTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/VfsClassLoaderTests.java
@@ -296,8 +296,8 @@ public class VfsClassLoaderTests extends AbstractProviderTestCase {
 
                 final Object testObject = testClass.newInstance();
                 assertEquals("**PRIVATE**", testObject.toString());
-            } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
-                throw new RuntimeException(e);
+            } catch (ReflectiveOperationException e) {
+                throw new IllegalStateException(e);
             }
         }
     }


[commons-vfs] 06/15: [local] Throw a specialized RuntimeException instead of RuntimeException

Posted by gg...@apache.org.
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 f0ab7c1e98da801913d6d6a8458483804be09067
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 16:24:59 2023 -0400

    [local] Throw a specialized RuntimeException instead of
    RuntimeException
---
 .../java/org/apache/commons/vfs2/provider/local/LocalFile.java | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFile.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFile.java
index dc607753..e2c28298 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFile.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFile.java
@@ -25,6 +25,7 @@ import java.nio.file.Files;
 import java.nio.file.OpenOption;
 import java.nio.file.StandardOpenOption;
 
+import org.apache.commons.io.file.PathUtils;
 import org.apache.commons.vfs2.FileObject;
 import org.apache.commons.vfs2.FileSystemException;
 import org.apache.commons.vfs2.FileType;
@@ -124,13 +125,8 @@ public class LocalFile extends AbstractFileObject<LocalFileSystem> {
      * Creates an output stream to write the file content to.
      */
     @Override
-    protected OutputStream doGetOutputStream(final boolean append) throws Exception {
-        // TODO Reuse Apache Commons IO
-        // @formatter:off
-        return Files.newOutputStream(file.toPath(), append ?
-            new OpenOption[] {StandardOpenOption.CREATE, StandardOpenOption.APPEND} :
-            new OpenOption[] {StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING});
-        // @formatter:on
+    protected OutputStream doGetOutputStream(final boolean append) throws IOException {
+        return PathUtils.newOutputStream(file.toPath(), append);
     }
 
     @Override


[commons-vfs] 11/15: [filter] Throw a specialized RuntimeException instead of RuntimeException

Posted by gg...@apache.org.
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 2228fd51d4116e7f0ede60e84ce8a05dd0858a41
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 16:25:51 2023 -0400

    [filter] Throw a specialized RuntimeException instead of
    RuntimeException
---
 .../src/test/java/org/apache/commons/vfs2/filter/BaseFilterTest.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/BaseFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/BaseFilterTest.java
index 1f9ec507..f38d335e 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/BaseFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/BaseFilterTest.java
@@ -24,6 +24,7 @@ import java.io.File;
 import java.io.FileFilter;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.UncheckedIOException;
 import java.nio.file.Files;
 import java.util.Arrays;
 import java.util.List;
@@ -124,7 +125,7 @@ public abstract class BaseFilterTest {
                     try {
                         return fileObject.getParent();
                     } catch (final FileSystemException ex) {
-                        throw new RuntimeException(ex);
+                        throw new UncheckedIOException(ex);
                     }
                 }
 
@@ -144,7 +145,7 @@ public abstract class BaseFilterTest {
                 }
             };
         } catch (final FileSystemException ex) {
-            throw new RuntimeException(ex);
+            throw new UncheckedIOException(ex);
         }
     }
 


[commons-vfs] 08/15: [zip] Throw a specialized RuntimeException instead of RuntimeException

Posted by gg...@apache.org.
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 dda6764448cebff561e55378bdd35b4cd4bc23c3
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 16:25:23 2023 -0400

    [zip] Throw a specialized RuntimeException instead of
    RuntimeException
---
 .../main/java/org/apache/commons/vfs2/provider/zip/ZipFileObject.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileObject.java
index 1853e829..26b4e920 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/zip/ZipFileObject.java
@@ -17,6 +17,7 @@
 package org.apache.commons.vfs2.provider.zip;
 
 import java.io.InputStream;
+import java.io.UncheckedIOException;
 import java.util.HashSet;
 import java.util.zip.ZipEntry;
 
@@ -125,7 +126,7 @@ public class ZipFileObject extends AbstractFileObject<ZipFileSystem> {
             }
         } catch (final FileSystemException e) {
             // should not happen as the type has already been cached.
-            throw new RuntimeException(e);
+            throw new UncheckedIOException(e);
         }
 
         return children.toArray(ArrayUtils.EMPTY_STRING_ARRAY);


[commons-vfs] 05/15: [http5] Throw a specialized RuntimeException instead of RuntimeException

Posted by gg...@apache.org.
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 974fabbec944195daff34036a9080ce3766ce2ab
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 16:24:50 2023 -0400

    [http5] Throw a specialized RuntimeException instead of
    RuntimeException
---
 .../java/org/apache/commons/vfs2/provider/http5/Http5FileSystem.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileSystem.java
index 63b7c361..c1b81f7c 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileSystem.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileSystem.java
@@ -17,6 +17,7 @@
 package org.apache.commons.vfs2.provider.http5;
 
 import java.io.IOException;
+import java.io.UncheckedIOException;
 import java.net.URI;
 import java.util.Collection;
 
@@ -91,7 +92,7 @@ public class Http5FileSystem extends AbstractFileSystem {
             try {
                 ((CloseableHttpClient) httpClient).close();
             } catch (final IOException e) {
-                throw new RuntimeException("Error closing HttpClient", e);
+                throw new UncheckedIOException("Error closing HttpClient", e);
             }
         }
     }


[commons-vfs] 14/15: [test] Throw a specialized RuntimeException instead of RuntimeException

Posted by gg...@apache.org.
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 1562bc942f85a57c85e2420dd494715e1f5fddaa
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 16:26:24 2023 -0400

    [test] Throw a specialized RuntimeException instead of
    RuntimeException
---
 commons-vfs2/src/test/java/org/apache/commons/vfs2/RunTest.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/RunTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/RunTest.java
index 2fab5163..bfd6281f 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/RunTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/RunTest.java
@@ -70,13 +70,13 @@ public class RunTest {
         final TestResult result = new TestResult() {
             @Override
             public synchronized void addError(final Test test, final Throwable throwable) {
-                // throw new RuntimeException(throwable.getMessage());
+                // throw new IllegalStateException(throwable.getMessage());
                 throwable.printStackTrace();
             }
 
             @Override
             public synchronized void addFailure(final Test test, final AssertionFailedError assertionFailedError) {
-                // throw new RuntimeException(assertionFailedError.getMessage());
+                // throw new IllegalStateException(assertionFailedError.getMessage());
                 assertionFailedError.printStackTrace();
             }
 


[commons-vfs] 15/15: Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-vfs.git

Posted by gg...@apache.org.
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 3bfae6ab6cf98730e825a1c823376a8e0bee77f3
Merge: 1562bc94 31cc52b1
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 23 16:26:50 2023 -0400

    Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-vfs.git

 pom.xml                 |  4 ++--
 src/changes/changes.xml | 11 +++++++----
 2 files changed, 9 insertions(+), 6 deletions(-)