java.nio.file.FileSystemException: /run/user/1000/gvfs/dav:host=localhost,port=42232,ssl=false,prefix=%2Fa/test: Operation not supported

JDK Bug System | Webbug Group | 7 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    FULL PRODUCT VERSION : java version "1.8.0_65" Java(TM) SE Runtime Environment (build 1.8.0_65-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode) ADDITIONAL OS VERSION INFORMATION : Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2 (2016-04-08) x86_64 GNU/Linux A DESCRIPTION OF THE PROBLEM : An attempt to open a FileChannel or AsynchronousFileChannel e.g. using FileChannel.open(path, StandardOpenOption.WRITE) fails if path points to a file on a gvfs mounted WebDav share. When using the terminal to inspect the share ls -l shows that the files are writable by the user running the java program. In addition using a FileOutputStream to write data to the file is possible. When mounting the same WebDav share using mount -t davfs [...] channels can be opened. When doing FileChannel.open(path, StandardOpenOption.READ) this works so seem to be releated to the WRITE option. I am note sure if this applies to all gvfs mounts or only WebDav shares. I confirmed this for a WebDav share. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : 1 Start a webdav server which may afterwards be reachable e.g. at http://localhost:42232/a 2 Use "gvfs-mount dav:localhost:42232/a" to mount the drive. 3 Create a file "test" in this share using e.g. a text editor. 4 Create a path to the file (gvfs mounted to /run/user/1000/gvfs/dav:host=localhost,port=42232,ssl=false,prefix=%2Fa in my example) 5 Use this path to create a file channel with the WRITE open option specified EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - Because writing is in general possible, e.g. using FileOutputStream, I would expect it to create a writable FileChannel as an alternativ an UnsupportedOperationException as specified in the javadoc of open could be thrown. ACTUAL - A FileSystemException (not UnsupportedOperationException) with message "Operation not supported" is thrown. ERROR MESSAGES/STACK TRACES THAT OCCUR : java.nio.file.FileSystemException: /run/user/1000/gvfs/dav:host=localhost,port=42232,ssl=false,prefix=%2Fa/test: Operation not supported at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) at sun.nio.fs.UnixFileSystemProvider.newAsynchronousFileChannel(UnixFileSystemProvider.java:196) at java.nio.channels.AsynchronousFileChannel.open(AsynchronousFileChannel.java:248) at java.nio.channels.AsynchronousFileChannel.open(AsynchronousFileChannel.java:301) [...] REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- private final String root = "/run/user/1000/gvfs/dav:host=localhost,port=42232,ssl=false,prefix=%2Fa"; private final Path test = Paths.get(root + "/test"); @Test public void testCreateChannelForWriting() throws IOException { try (FileChannel channel = FileChannel.open(test, StandardOpenOption.WRITE)) { } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : Mount the filesystem using mount -t davfs [...] instead of gvfs. This is possible in some cases but not always an option because the mount process used by third party software can not always be influenced.

    JDK Bug System | 7 months ago | Webbug Group
    java.nio.file.FileSystemException: /run/user/1000/gvfs/dav:host=localhost,port=42232,ssl=false,prefix=%2Fa/test: Operation not supported
  2. 0

    why AsynchronousFileChannel for multi-thread I/Os throws java.nio.file.FileSystemException?

    Stack Overflow | 4 years ago | ChrisGr
    java.nio.file.FileSystemException: C:\Documents and Settings\Administrator\workspace\TileMap\FileMap.txt: The process cannot access the file because it is being used by another process.</p> <pre><code>at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86)

    Root Cause Analysis

    1. java.nio.file.FileSystemException

      /run/user/1000/gvfs/dav:host=localhost,port=42232,ssl=false,prefix=%2Fa/test: Operation not supported

      at sun.nio.fs.UnixException.translateToIOException()
    2. Java RT
      AsynchronousFileChannel.open
      1. sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
      2. sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
      3. sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
      4. sun.nio.fs.UnixFileSystemProvider.newAsynchronousFileChannel(UnixFileSystemProvider.java:196)
      5. java.nio.channels.AsynchronousFileChannel.open(AsynchronousFileChannel.java:248)
      6. java.nio.channels.AsynchronousFileChannel.open(AsynchronousFileChannel.java:301)
      6 frames