### Eclipse Workspace Patch 1.0 #P org.eclipse.osgi Index: supplement/src/org/eclipse/core/runtime/internal/adaptor/Locker_JavaNio.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.osgi/supplement/src/org/eclipse/core/runtime/internal/adaptor/Locker_JavaNio.java,v retrieving revision 1.7 diff -u -r1.7 Locker_JavaNio.java --- supplement/src/org/eclipse/core/runtime/internal/adaptor/Locker_JavaNio.java 11 Sep 2007 17:33:15 -0000 1.7 +++ supplement/src/org/eclipse/core/runtime/internal/adaptor/Locker_JavaNio.java 27 Nov 2007 14:31:16 -0000 @@ -8,12 +8,12 @@ * Contributors: * IBM Corporation - initial API and implementation * Danail Nachev (Prosyst) - bug 185654 + * Andrei Loskutov - bug 44735 *******************************************************************************/ package org.eclipse.core.runtime.internal.adaptor; import java.io.*; -import java.nio.channels.FileLock; -import java.nio.channels.OverlappingFileLockException; +import java.nio.channels.*; import org.eclipse.osgi.util.NLS; /** @@ -31,7 +31,12 @@ public synchronized boolean lock() throws IOException { raFile = new RandomAccessFile(lockFile, "rw"); //$NON-NLS-1$ try { - fileLock = raFile.getChannel().tryLock(); + /* + * fix for bug http://bugs.sun.com/view_bug.do?bug_id=6628575 and + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44735#c17 + */ + FileChannel fc = raFile.getChannel(); + fileLock = fc.tryLock(0, fc.size(), false); } catch (IOException ioe) { // print exception if debugging if (BasicLocation.DEBUG) @@ -77,7 +82,12 @@ RandomAccessFile temp = new RandomAccessFile(lockFile, "rw"); //$NON-NLS-1$ FileLock tempLock = null; try { - tempLock = temp.getChannel().tryLock(); + /* + * fix for bug http://bugs.sun.com/view_bug.do?bug_id=6628575 and + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44735#c17 + */ + FileChannel fc = temp.getChannel(); + tempLock = fc.tryLock(0, fc.size(), false); if (tempLock != null) { tempLock.release(); // allow IOException to propagate because that would mean it is still locked return false;