On Windows the lock is aquired in the test testUpdateRefLockFailureLocked (RefUpdateTest) for the file but it never released. This causes test failure during resource cleanup, since locked file could not be deleted on Windows. This commits adds unlock operation in the finally block, so there is no more cleanup problem. Signed-off-by: Constantine Plotnikov <constantine.plotnikov@xxxxxxxxx> --- .../tst/org/spearce/jgit/lib/RefUpdateTest.java | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RefUpdateTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RefUpdateTest.java index 6b1975a..b14f19a 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RefUpdateTest.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RefUpdateTest.java @@ -255,12 +255,16 @@ public void testUpdateRefLockFailureLocked() throws IOException { RefUpdate updateRef = db.updateRef("refs/heads/master"); updateRef.setNewObjectId(pid); LockFile lockFile1 = new LockFile(new File(db.getDirectory(),"refs/heads/master")); - assertTrue(lockFile1.lock()); // precondition to test - Result update = updateRef.update(); - assertEquals(Result.LOCK_FAILURE, update); - assertEquals(opid, db.resolve("refs/heads/master")); - LockFile lockFile2 = new LockFile(new File(db.getDirectory(),"refs/heads/master")); - assertFalse(lockFile2.lock()); // was locked, still is + try { + assertTrue(lockFile1.lock()); // precondition to test + Result update = updateRef.update(); + assertEquals(Result.LOCK_FAILURE, update); + assertEquals(opid, db.resolve("refs/heads/master")); + LockFile lockFile2 = new LockFile(new File(db.getDirectory(),"refs/heads/master")); + assertFalse(lockFile2.lock()); // was locked, still is + } finally { + lockFile1.unlock(); + } } /** -- 1.6.1.2 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html