You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Thomas BELOT (Jira)" <ji...@apache.org> on 2020/04/08 11:40:00 UTC

[jira] [Created] (VFS-770) GZ createFileSystem fails

Thomas BELOT created VFS-770:
--------------------------------

             Summary: GZ createFileSystem fails
                 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


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".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 triggered a null or a application/x-gzip it would not lead to this problem.

Forcing resolution with fsManager.createFileSystem("gz",f) is a workaround 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)