You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2022/04/20 23:03:00 UTC

[jira] [Resolved] (VFS-770) FileSystemManager.createFileSystem(FileObject) fails on Gzip files.

     [ https://issues.apache.org/jira/browse/VFS-770?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory resolved VFS-770.
---------------------------------
    Fix Version/s: 2.10.0
       Resolution: Fixed

A fix is in git master. Please verify and close.

 

> FileSystemManager.createFileSystem(FileObject) fails on Gzip files.
> -------------------------------------------------------------------
>
>                 Key: VFS-770
>                 URL: https://issues.apache.org/jira/browse/VFS-770
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.6.0
>         Environment: Both Java 8 and Java 13
>            Reporter: Thomas BELOT
>            Priority: Major
>             Fix For: 2.10.0
>
>
> Stack trace : 
> {noformat}
> Exception in thread "main" org.apache.commons.vfs2.FileSystemException: Could not find a file provider that can handle file "file:///C:/DIR/00-test.gz".
> 	at org.apache.commons.vfs2.FileSystemException.requireNonNull(FileSystemException.java:87)
> 	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.createFileSystem(DefaultFileSystemManager.java:909)
> 	at MyClass.test(MyClass.java:77)
> 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
> 	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
> 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
> 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
> 	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
> 	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
> 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> 	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
> 	at one.util.streamex.AbstractStreamEx.forEach(AbstractStreamEx.java:314)
> 	at MyClass.main(MyClass.java:45)
> {noformat}
> Caused by : [fileNameMap.getContentTypeFor(name);|https://gitbox.apache.org/repos/asf?p=commons-vfs.git;a=blob;f=commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/FileContentInfoFilenameFactory.java;h=2888ff6545055c8d00cbd73412671d17560b2592;hb=HEAD#l42] which delegates content type resolution to Java's URLConnection.getFileNameMap() which in turn resolves GZip to a generic application/octet-stream hence leading to this exception.
>  If the resolution had triggered a null or an application/x-gzip it would not have lead to this problem.
> Forcing resolution with fsManager.createFileSystem("gz",f) is a workaround



--
This message was sent by Atlassian Jira
(v8.20.7#820007)