-
Notifications
You must be signed in to change notification settings - Fork 1.1k
FileChannelCache.tryLockFor creates empty files #3076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Milestone
Comments
EmmanuelRoux
added a commit
to EmmanuelRoux/spring-integration
that referenced
this issue
Oct 11, 2019
EmmanuelRoux
added a commit
to EmmanuelRoux/spring-integration
that referenced
this issue
Oct 17, 2019
EmmanuelRoux
added a commit
to EmmanuelRoux/spring-integration
that referenced
this issue
Oct 17, 2019
EmmanuelRoux
added a commit
to EmmanuelRoux/spring-integration
that referenced
this issue
Oct 17, 2019
EmmanuelRoux
added a commit
to EmmanuelRoux/spring-integration
that referenced
this issue
Oct 17, 2019
artembilan
pushed a commit
that referenced
this issue
Oct 17, 2019
Fixes #3076 * Return `null` instead of throwing an exception * Fix license header * Add missing `@since` * Avoid over-engineered test logic * Fix code style * Test non-existent file does not get created * Fix: remove unused import
artembilan
pushed a commit
that referenced
this issue
Oct 17, 2019
Fixes #3076 * Return `null` instead of throwing an exception * Fix license header * Add missing `@since` * Avoid over-engineered test logic * Fix code style * Test non-existent file does not get created * Fix: remove unused import
artembilan
pushed a commit
that referenced
this issue
Oct 17, 2019
Fixes #3076 * Return `null` instead of throwing an exception * Fix license header * Add missing `@since` * Avoid over-engineered test logic * Fix code style * Test non-existent file does not get created * Fix: remove unused import * Remove Java 8 constructions; revert AssertJ to regular JUnit assertions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi all
FileChannelCache.tryLockFor(File)
actually creates an empty file when trying to get a lock on a non-existent file.It seems to be caused by line 56
FileChannel newChannel = new RandomAccessFile(fileToLock, "rw").getChannel();
which opens the file using "rw" mode (create the file if it does not exist)Tested on v5.1.5.RELEASE, seems to still be the same on v5.2.0.RELEASE.
It may be better to either :
To reproduce, just call :
FileChannelCache.tryLockFor(new File("/a/file/that/does/not/exists.txt"));
Thanks!
The text was updated successfully, but these errors were encountered: