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
This commit is contained in:
Andrew Overholt
2005-05-03 22:38:17 +00:00
committed by Tom Tromey
parent 8148fe656d
commit f525d7a75f
3 changed files with 23 additions and 3 deletions
@@ -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
{