diff options
author | Andrew Overholt <overholt@redhat.com> | 2005-05-03 22:38:17 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2005-05-03 22:38:17 +0000 |
commit | f525d7a75ffa9e02d094828e91b2c8af49272e61 (patch) | |
tree | d6cc1093a809e003aab0e160015f13e1f04bca5f /libjava/gnu/java | |
parent | 8148fe656d06e12c5d34e8fa56e23ee7eb9d5841 (diff) | |
download | gcc-f525d7a75ffa9e02d094828e91b2c8af49272e61.zip gcc-f525d7a75ffa9e02d094828e91b2c8af49272e61.tar.gz gcc-f525d7a75ffa9e02d094828e91b2c8af49272e61.tar.bz2 |
re PR libgcj/21372 (FileChannel.tryLock() return value incorrect)
2005-05-03 Andrew Overholt <overholt@redhat.com>
PR libgcj/21372:
* gnu/java/nio/channels/FileChannelImpl.java: Return null if lock
could not be acquired.
* java/nio/channels/FileLock.java (toString): Re-implement to be
in line with other implementations.
From-SVN: r99188
Diffstat (limited to 'libjava/gnu/java')
-rw-r--r-- | libjava/gnu/java/nio/channels/FileChannelImpl.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libjava/gnu/java/nio/channels/FileChannelImpl.java b/libjava/gnu/java/nio/channels/FileChannelImpl.java index aaa4c26..6893d81 100644 --- a/libjava/gnu/java/nio/channels/FileChannelImpl.java +++ b/libjava/gnu/java/nio/channels/FileChannelImpl.java @@ -437,9 +437,11 @@ public final class FileChannelImpl extends FileChannel try { begin(); - lock(position, size, shared, false); + boolean lockable = lock(position, size, shared, false); completed = true; - return new FileLockImpl(this, position, size, shared); + return (lockable + ? new FileLockImpl(this, position, size, shared) + : null); } finally { |