Skip to content

When a file is locked, moving it doesn't throw FileSystemException #160

Description

@jacekgajek

In a real file system, the following code would throw FileSystemException with a message "[file]: Device or resource busy" (on Linux).

The memory file system throws exception with message "file still open" when I attempt to delete a file.

However, moving a file does not result in exception

FileChannel.open(sourceFile, StandardOpenOption.WRITE).use { channel ->
    channel.tryLock().use {
         Files.move(sourcePath, targetPath)
    }
}

Expected

FileSystemException with message "[sourcePath]: Device or resource busy".

Actual

No exception is thrown.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions