diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2013-03-26 21:20:19 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2013-03-26 21:26:07 +0100 |
commit | d059f85c0bb2f9de9977cf4e0f1f72647aa4b4b2 (patch) | |
tree | 3fe74ec53415c409bd6b8b5aa744334afc74db63 | |
parent | 7f1c2ec1eb81fa1dfca7bfe55bdfb9e8559dcaa2 (diff) | |
download | jgit-d059f85c0bb2f9de9977cf4e0f1f72647aa4b4b2.tar.gz jgit-d059f85c0bb2f9de9977cf4e0f1f72647aa4b4b2.zip |
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>
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java | 11 |
1 files 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 625ec343fd..06eb42cbbc 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; } |