[ https://issues.apache.org/jira/browse/VFS-770?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17527834#comment-17527834 ]
Bernd Eckenfels commented on VFS-770: ------------------------------------- BTW just FYI April 22 Update of Java 17 (and others) introduced new Mime types including the ones for `.gz` (`application/gzip`) and `.jar` (`application/java-archive`). This bugfix helps with these new types in a way that it will consider the file extensions when the new types are not registered. It therefore would have prevented a regression for us. Backports are here: https://bugs.openjdk.java.net/browse/JDK-8273655 > 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)