Operation not supported

JDK Bug System | Hendrik Schreiber | 8 months ago
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    Samba Share + Grade = Java IO Exception

    Stack Overflow | 2 years ago | christian667 Operation not supported
  2. 0

    When trying to lock a file that is on a SMB or an AFP network filesystem, FileChannel.tryLock() throws an IOException with the message "Operation not supported" . The reason seems to be that the JRE uses the call fcntl to try to lock files on these network shares. On OS X fcntl does not support locking files on AFP or SMB (I believe NFS works alright, but am not certain). A possible alternative is perhaps the call flock for AFP and SMB. More general information can be found on,_Mac_OS_X,_and_SMB.html To test the problem, mount an SMB or AFP share on a OS X machine. Then run this code with one of the mounted files as argument: import*; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; public class FileLockTest { public static void main(String[] args) throws Exception { RandomAccessFile file = null; FileLock fileLock = null; try { file = new RandomAccessFile(args[0], "rw"); FileChannel fileChannel = file.getChannel(); fileLock = fileChannel.tryLock(); if (fileLock != null){ System.out.println("File is locked"); } } finally{ if (fileLock != null){ fileLock.release(); } } } } When working properly, you should see the text "File is locked". When failing, you see something like: Exception in thread "main" Operation not supported at Method) at at at java.nio.channels.FileChannel.tryLock( at FileLockTest.main( Please note that the thrown exception is not very helpful, because it is a plain IOException with some message. As a programmer, I'd like to distinguish between a real failure or an unsupported operation. Even if for some reason proper locking cannot be implemented, please implement a specific exception that is thrown in case a file cannot be locked, because the mechanism isn't properly implemented or supported by the OS. Something like FileLockUnsupportedException (subclass of IOException) with a proper reason that perhaps contains the filesystem type.

    JDK Bug System | 8 months ago | Hendrik Schreiber Operation not supported
  3. 0

    Bug ID: JDK-4532474 (fs) FileChannel.lock()/tryLock() methods unusable | 1 year ago The parameter is incorrect
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Bug 46548 – Eclipse crashes on launch when workspace not on local drive | 1 year ago Operation not supported
  6. 0

    Eclipse crashes on launch when workspace not on local drive

    Eclipse Bugzilla | 1 decade ago | anewby Operation not supported

  1. Hiren 2 times, last 1 week ago
  2. Indri Yunita 1 times, last 3 months ago
  3. ivotje50 41 times, last 8 months ago
  4. Avinash8989 7 times, last 10 months ago
  5. ank_07 7 times, last 10 months ago
9 more registered users
3 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis


    Operation not supported

  2. Java RT
    1. Method)
    4. java.nio.channels.FileChannel.tryLock(
    4 frames
  3. Unknown
    1. FileLockTest.main(
    1 frame