Browse Source

When renaming the lock file succeeds the lock isn't held anymore

This wrong book-keeping caused IOExceptions to be thrown because
LockFile.unlock() erroneously tried to delete the non-existing lock
file. These IOExeptions were hidden since they were silently caught. 

Change-Id: If42b6192d92c5a2d8f2bf904b16567ef08c32e89
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
tags/v3.0.0.201305080800-m7
Matthias Sohn 11 years ago
parent
commit
d059f85c0b

+ 8
- 3
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java View File

@@ -437,11 +437,16 @@ public class LockFile {
}

saveStatInformation();
if (lck.renameTo(ref))
if (lck.renameTo(ref)) {
haveLck = false;
return true;
if (!ref.exists() || deleteRef())
if (renameLock())
}
if (!ref.exists() || deleteRef()) {
if (renameLock()) {
haveLck = false;
return true;
}
}
unlock();
return false;
}

Loading…
Cancel
Save