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 52386a1e Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-vfs.git 52386a1e is described below commit 52386a1eab6a91b49d61428453be37b1f943e4f8 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Fri Jun 23 16:52:31 2023 -0400 Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-vfs.git --- commons-vfs2/pom.xml | 1 - .../apache/commons/vfs2/provider/AbstractFileObject.java | 7 ++----- .../apache/commons/vfs2/provider/DefaultURLConnection.java | 13 +++---------- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/commons-vfs2/pom.xml b/commons-vfs2/pom.xml index 7fd12e9e..3bd63959 100644 --- a/commons-vfs2/pom.xml +++ b/commons-vfs2/pom.xml @@ -153,7 +153,6 @@ <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> - <scope>test</scope> </dependency> <!-- Test HTTP with Apache HttpComponent Core --> <dependency> 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 eb8981da..6291a6ee 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 @@ -36,6 +36,7 @@ import java.util.Map; import java.util.Objects; import java.util.stream.Stream; +import org.apache.commons.io.function.Uncheck; import org.apache.commons.vfs2.Capability; import org.apache.commons.vfs2.FileContent; import org.apache.commons.vfs2.FileContentInfoFactory; @@ -1862,11 +1863,7 @@ public abstract class AbstractFileObject<AFS extends AbstractFileSystem> impleme private void setFileType(final FileType type) { if (type != null && type != FileType.IMAGINARY) { - try { - fileName.setType(type); - } catch (final FileSystemException e) { - throw new UncheckedIOException(e); - } + Uncheck.run(() -> fileName.setType(type)); } this.type = type; } 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 ad10f764..17c0c567 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 @@ -23,6 +23,7 @@ import java.io.UncheckedIOException; import java.net.URL; import java.net.URLConnection; +import org.apache.commons.io.function.Uncheck; import org.apache.commons.vfs2.FileContent; import org.apache.commons.vfs2.FileSystemException; @@ -51,11 +52,7 @@ public final class DefaultURLConnection extends URLConnection { @Override public String getContentEncoding() { - try { - return fileContent.getContentInfo().getContentEncoding(); - } catch (final FileSystemException e) { - throw new UncheckedIOException(e); - } + return Uncheck.get(() -> fileContent.getContentInfo().getContentEncoding()); } @Override @@ -69,11 +66,7 @@ public final class DefaultURLConnection extends URLConnection { @Override public String getContentType() { - try { - return fileContent.getContentInfo().getContentType(); - } catch (final FileSystemException e) { - throw new UncheckedIOException(e); - } + return Uncheck.get(() -> fileContent.getContentInfo().getContentType()); } @Override