From d059f85c0bb2f9de9977cf4e0f1f72647aa4b4b2 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Tue, 26 Mar 2013 21:20:19 +0100 Subject: [PATCH] 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 --- .../eclipse/jgit/internal/storage/file/LockFile.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java index 625ec343f..06eb42cbb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java @@ -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; }