Bump JGit to v4.0.0.201506090130-r

This JGit version includes the bugfix [1] which is an attempt to fix the
"Cannot read project" issue in Gerrit, as discussed in [2] and [3].

This version of JGit also removes the 'release()' method in many
interfaces/classes in favor or the implementing the AutoCloseable
interface. In stable-2.10 we just replace all usages of the release()
method with the close() method. Refactoring the code to make use of the
AutoCloseable in stable-2.10 would be a larger change which wouldn't
justify itself as we don't expect any major development in stable-2.10
and the usage of AutoCloseable in the master branch is already done.

[1] https://git.eclipse.org/r/48288
[2] https://groups.google.com/forum/#!topic/repo-discuss/ZeGWPyyJlrM
[3] https://groups.google.com/forum/#!topic/repo-discuss/CYYoHfDxCfA

Change-Id: Ie540296238e3bbaf453c9e29426825431e15d423
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/GitUtil.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/GitUtil.java
index 3234ffd..0356f72 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/GitUtil.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/GitUtil.java
@@ -184,7 +184,7 @@
         return ChangeIdUtil.computeChangeId(null, null, i, i, msg);
       }
     } finally {
-      rw.release();
+      rw.close();
     }
   }
 
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/SubmitOnPushIT.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/SubmitOnPushIT.java
index a73169d..763b25f 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/SubmitOnPushIT.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/git/SubmitOnPushIT.java
@@ -292,7 +292,7 @@
         assertEquals(admin.email, c.getAuthorIdent().getEmailAddress());
         assertEquals(admin.email, c.getCommitterIdent().getEmailAddress());
       } finally {
-        rw.release();
+        rw.close();
       }
     } finally {
       r.close();
@@ -310,7 +310,7 @@
         assertEquals(admin.email, c.getAuthorIdent().getEmailAddress());
         assertEquals(serverIdent.getEmailAddress(), c.getCommitterIdent().getEmailAddress());
       } finally {
-        rw.release();
+        rw.close();
       }
     } finally {
       r.close();
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java
index ab8a5fc..6c36e37 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java
@@ -265,7 +265,7 @@
             repo.getRef("refs/heads/master").getObjectId()));
         return Lists.newArrayList(rw);
       } finally {
-        rw.release();
+        rw.close();
       }
     } finally {
       repo.close();
@@ -278,7 +278,7 @@
       try {
         return rw.parseCommit(repo.getRef(name).getObjectId());
       } finally {
-        rw.release();
+        rw.close();
       }
     } finally {
       repo.close();
@@ -300,7 +300,7 @@
         ObjectId newTreeId = repo.resolve("refs/heads/master^{tree}");
         return getLatestDiff(repo, oldTreeId, newTreeId);
       } finally {
-        rw.release();
+        rw.close();
       }
     } finally {
       repo.close();
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/project/CreateProjectIT.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/project/CreateProjectIT.java
index cdf671d..d441f96 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/project/CreateProjectIT.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/project/CreateProjectIT.java
@@ -252,8 +252,8 @@
         tw.reset();
       }
     } finally {
-      tw.release();
-      rw.release();
+      tw.close();
+      rw.close();
       repo.close();
     }
   }
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/raw/CatServlet.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/raw/CatServlet.java
index 9aec609..756c427 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/raw/CatServlet.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/raw/CatServlet.java
@@ -209,7 +209,7 @@
           return;
         }
       } finally {
-        reader.release();
+        reader.close();
       }
     } catch (IOException e) {
       getServletContext().log("Cannot read repository", e);
diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/AllProjectsConfig.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/AllProjectsConfig.java
index cd4a0b8..03f6d1c 100644
--- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/AllProjectsConfig.java
+++ b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/AllProjectsConfig.java
@@ -136,15 +136,15 @@
           updateRef(repo, ident, newRevision, "commit: " + msg);
           revision = newRevision;
         } finally {
-          rw.release();
+          rw.close();
         }
       } finally {
         if (inserter != null) {
-          inserter.release();
+          inserter.close();
           inserter = null;
         }
         if (reader != null) {
-          reader.release();
+          reader.close();
           reader = null;
         }
       }
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/ChangeUtil.java b/gerrit-server/src/main/java/com/google/gerrit/server/ChangeUtil.java
index 80213f6..249bd38 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/ChangeUtil.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/ChangeUtil.java
@@ -300,7 +300,7 @@
           oi.flush();
           revertCommit = revWalk.parseCommit(id);
         } finally {
-          oi.release();
+          oi.close();
         }
 
         RefControl refControl = ctl.getRefControl();
@@ -364,7 +364,7 @@
 
         return change.getId();
       } finally {
-        revWalk.release();
+        revWalk.close();
       }
     } finally {
       git.close();
@@ -423,7 +423,7 @@
           oi.flush();
           newCommit = revWalk.parseCommit(id);
         } finally {
-          oi.release();
+          oi.close();
         }
 
         PatchSet.Id id = nextPatchSetId(git, change.currentPatchSetId());
@@ -446,7 +446,7 @@
 
         return change.getId();
       } finally {
-        revWalk.release();
+        revWalk.close();
       }
     } finally {
       git.close();
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java
index 8d98a4c..82d783c 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeKindCacheImpl.java
@@ -228,7 +228,7 @@
         }
       } finally {
         key.repo = null;
-        walk.release();
+        walk.close();
       }
     }
 
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/CherryPickChange.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/CherryPickChange.java
index b1f6d8c..fd23f33 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/CherryPickChange.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/CherryPickChange.java
@@ -154,7 +154,7 @@
               mergeUtilFactory.create(projectState).createCherryPickFromCommit(git, oi, mergeTip,
                   commitToCherryPick, committerIdent, commitMessage, revWalk);
         } finally {
-          oi.release();
+          oi.close();
         }
 
         if (cherryPickCommit == null) {
@@ -192,7 +192,7 @@
               cherryPickCommit, refControl, identifiedUser);
         }
       } finally {
-        revWalk.release();
+        revWalk.close();
       }
     } finally {
       git.close();
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/CreateChange.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/CreateChange.java
index 263f7f1..04c12c3 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/CreateChange.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/CreateChange.java
@@ -184,7 +184,7 @@
 
         return Response.created(json.format(change.getId()));
       } finally {
-        rw.release();
+        rw.close();
       }
     } finally {
       git.close();
@@ -250,7 +250,7 @@
       commit.setMessage(commitMessage);
       emptyCommit = rw.parseCommit(insert(oi, commit));
     } finally {
-      oi.release();
+      oi.close();
     }
     return emptyCommit;
   }
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/Files.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/Files.java
index 74659b8..0689aec 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/Files.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/Files.java
@@ -274,7 +274,7 @@
           db.get().accountPatchReviews().insert(inserts);
           return pathList;
         } finally {
-          reader.release();
+          reader.close();
         }
       } finally {
         git.close();
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/GetArchive.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/GetArchive.java
index d602c47..913f69e 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/GetArchive.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/GetArchive.java
@@ -126,7 +126,7 @@
 
           @Override
           public void close() throws IOException {
-            rw.release();
+            rw.close();
             repo.close();
           }
         };
@@ -139,7 +139,7 @@
         return bin;
       } finally {
         if (close) {
-          rw.release();
+          rw.close();
         }
       }
     } finally {
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/GetContent.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/GetContent.java
index bfc1df9..62458cd 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/GetContent.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/GetContent.java
@@ -73,10 +73,10 @@
           };
           return result.setContentLength(object.getSize()).base64();
         } finally {
-          tw.release();
+          tw.close();
         }
       } finally {
-        rw.release();
+        rw.close();
       }
     } finally {
       repo.close();
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/GetPatch.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/GetPatch.java
index 4a8be84..4e40d62 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/GetPatch.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/GetPatch.java
@@ -102,7 +102,7 @@
 
           @Override
           public void close() throws IOException {
-            rw.release();
+            rw.close();
             repo.close();
           }
         };
@@ -123,7 +123,7 @@
         return bin;
       } finally {
         if (close) {
-          rw.release();
+          rw.close();
         }
       }
     } finally {
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/GetRelated.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/GetRelated.java
index 0ccb15c..b58572c 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/GetRelated.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/GetRelated.java
@@ -83,7 +83,7 @@
         info.changes = walk(rsrc, rw, ref);
         return info;
       } finally {
-        rw.release();
+        rw.close();
       }
     } finally {
       git.close();
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/IncludedIn.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/IncludedIn.java
index e0cdebb..410bcab 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/IncludedIn.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/IncludedIn.java
@@ -71,7 +71,7 @@
         }
         return new IncludedInInfo(IncludedInResolver.resolve(r, rw, rev));
       } finally {
-        rw.release();
+        rw.close();
       }
     } finally {
       r.close();
@@ -87,4 +87,4 @@
       tags = in.getTags();
     }
   }
-}
\ No newline at end of file
+}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/Mergeable.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/Mergeable.java
index c17afb8..b9daaf4 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/Mergeable.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/Mergeable.java
@@ -245,7 +245,7 @@
           "Cannot merge test change %d", change.getId().get()), e);
       return false;
     } finally {
-      rw.release();
+      rw.close();
     }
   }
 
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/changedetail/RebaseChange.java b/gerrit-server/src/main/java/com/google/gerrit/server/changedetail/RebaseChange.java
index 070203d..77fb178 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/changedetail/RebaseChange.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/changedetail/RebaseChange.java
@@ -142,10 +142,10 @@
       throw new IOException(e.getMessage());
     } finally {
       if (inserter != null) {
-        inserter.release();
+        inserter.close();
       }
       if (rw != null) {
-        rw.release();
+        rw.close();
       }
       if (git != null) {
         git.close();
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/BanCommit.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/BanCommit.java
index 7ff91ef..05ee1db 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/BanCommit.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/BanCommit.java
@@ -69,7 +69,7 @@
         RevCommit map = rw.parseCommit(ref.getObjectId());
         return NoteMap.read(rw.getObjectReader(), map);
       } finally {
-        rw.release();
+        rw.close();
       }
     } catch (IOException badMap) {
       throw new IOException("Cannot load " + RefNames.REFS_REJECT_COMMITS,
@@ -138,8 +138,8 @@
         }
         return result;
       } finally {
-        revWalk.release();
-        inserter.release();
+        revWalk.close();
+        inserter.close();
       }
     } finally {
       repo.close();
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/MergeOp.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/MergeOp.java
index 3f0a70d..7855b63 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/MergeOp.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/MergeOp.java
@@ -304,10 +304,10 @@
       throw new MergeException("Cannot query the database", e);
     } finally {
       if (inserter != null) {
-        inserter.release();
+        inserter.close();
       }
       if (rw != null) {
-        rw.release();
+        rw.close();
       }
       if (repo != null) {
         repo.close();
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/MergeUtil.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/MergeUtil.java
index 709a8ac..cf348ad 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/MergeUtil.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/MergeUtil.java
@@ -671,7 +671,7 @@
       }
 
       @Override
-      public void release() {
+      public void close() {
       }
     });
     return (ThreeWayMerger) m;
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/NotesBranchUtil.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/NotesBranchUtil.java
index f1b0a78..fb96a6b 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/NotesBranchUtil.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/NotesBranchUtil.java
@@ -153,8 +153,8 @@
       }
       updateRef(notesBranch);
     } finally {
-      revWalk.release();
-      reader.release();
+      revWalk.close();
+      reader.close();
     }
   }
 
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/SubmoduleOp.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/SubmoduleOp.java
index 52e2268..89d3202 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/SubmoduleOp.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/SubmoduleOp.java
@@ -383,7 +383,7 @@
             + subscriber.get(), e);
     } finally {
       if (recRw != null) {
-        recRw.release();
+        recRw.close();
       }
       if (pdb != null) {
         pdb.close();
@@ -403,7 +403,7 @@
       b.finish();
       return dc;
     } finally {
-      rw.release();
+      rw.close();
     }
   }
 
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/TagSet.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/TagSet.java
index 761d5d6..6519bd9 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/TagSet.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/TagSet.java
@@ -147,7 +147,7 @@
       }
     } finally {
       if (rw != null) {
-        rw.release();
+        rw.close();
       }
     }
   }
@@ -189,7 +189,7 @@
     } catch (IOException e) {
       log.warn("Error building tags for repository " + projectName, e);
     } finally {
-      rw.release();
+      rw.close();
     }
   }
 
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/VersionedMetaData.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/VersionedMetaData.java
index 7828973..de37215 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/VersionedMetaData.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/VersionedMetaData.java
@@ -117,7 +117,7 @@
       revision = id != null ? new RevWalk(reader).parseCommit(id) : null;
       onLoad();
     } finally {
-      reader.release();
+      reader.close();
       reader = null;
     }
   }
@@ -306,12 +306,12 @@
         newTree = null;
 
         if (inserter != null) {
-          inserter.release();
+          inserter.close();
           inserter = null;
         }
 
         if (reader != null) {
-          reader.release();
+          reader.close();
           reader = null;
         }
       }
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/index/ChangeBatchIndexer.java b/gerrit-server/src/main/java/com/google/gerrit/server/index/ChangeBatchIndexer.java
index fac1c55..4779674 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/index/ChangeBatchIndexer.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/index/ChangeBatchIndexer.java
@@ -319,7 +319,7 @@
           getPathsAndIndex(id);
         }
       } finally {
-        walk.release();
+        walk.close();
       }
       return null;
     }
@@ -353,7 +353,7 @@
             }
           }
         } finally {
-          df.release();
+          df.close();
         }
       } catch (Exception e) {
         fail("Failed to index commit " + b.name(), false, e);
@@ -398,7 +398,7 @@
         oi.flush();
         return id;
       } finally {
-        oi.release();
+        oi.close();
       }
     }
 
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/ChangeEmail.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/ChangeEmail.java
index d38c5a3..b3c0d61 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/ChangeEmail.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/ChangeEmail.java
@@ -407,7 +407,7 @@
       log.error("Cannot format patch", e);
       return "";
     } finally {
-      fmt.release();
+      fmt.close();
       git.close();
     }
   }
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/PatchSetNotificationSender.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/PatchSetNotificationSender.java
index 76b896a..b847a91 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/PatchSetNotificationSender.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/PatchSetNotificationSender.java
@@ -95,7 +95,7 @@
         commit = revWalk.parseCommit(ObjectId.fromString(
             updatedPatchSet.getRevision().get()));
       } finally {
-        revWalk.release();
+        revWalk.close();
       }
       final PatchSetInfo info = patchSetInfoFactory.get(commit, updatedPatchSet.getId());
       final List<FooterLine> footerLines = commit.getFooterLines();
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/notedb/ChangeNotes.java b/gerrit-server/src/main/java/com/google/gerrit/server/notedb/ChangeNotes.java
index b242d7c..a33209c 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/notedb/ChangeNotes.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/notedb/ChangeNotes.java
@@ -575,7 +575,7 @@
       // TODO(yyonas): figure out how to handle this exception
       throw new IOException(e1);
     } finally {
-      walk.release();
+      walk.close();
     }
   }
 
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchFile.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchFile.java
index 81f4352..c65262f 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchFile.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchFile.java
@@ -75,7 +75,7 @@
         bTree = bCommit.getTree();
       }
     } finally {
-      reader.release();
+      reader.close();
     }
   }
 
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListLoader.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListLoader.java
index 94050d7..5444e4a 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListLoader.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListLoader.java
@@ -189,7 +189,7 @@
       return new PatchList(a, b, againstParent,
           entries.toArray(new PatchListEntry[entries.size()]));
     } finally {
-      reader.release();
+      reader.close();
     }
   }
 
@@ -342,7 +342,7 @@
         }
 
         @Override
-        public void release() {
+        public void close() {
         }
       });
 
@@ -454,7 +454,7 @@
 
       return rw.lookupTree(treeId);
     } finally {
-      ins.release();
+      ins.close();
     }
   }
 
@@ -465,7 +465,7 @@
       oi.flush();
       return id;
     } finally {
-      oi.release();
+      oi.close();
     }
   }
 }
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptBuilder.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptBuilder.java
index 0c98ccf..3f87aef 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptBuilder.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptBuilder.java
@@ -119,7 +119,7 @@
     try {
       return build(content, comments, history);
     } finally {
-      reader.release();
+      reader.close();
     }
   }
 
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchSetInfoFactory.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchSetInfoFactory.java
index 340300a..0571b58 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchSetInfoFactory.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchSetInfoFactory.java
@@ -94,7 +94,7 @@
         info.setParents(toParentInfos(src.getParents(), rw));
         return info;
       } finally {
-        rw.release();
+        rw.close();
       }
     } catch (IOException e) {
       throw new PatchSetInfoNotAvailableException(e);
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/CommitsCollection.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/CommitsCollection.java
index f27dc6e..f82142a 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/CommitsCollection.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/CommitsCollection.java
@@ -75,7 +75,7 @@
       } catch (MissingObjectException | IncorrectObjectTypeException e) {
         throw new ResourceNotFoundException(id);
       } finally {
-        rw.release();
+        rw.close();
       }
     } finally {
       repo.close();
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/GetHead.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/GetHead.java
index f05ece4..29c44b5 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/GetHead.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/GetHead.java
@@ -71,7 +71,7 @@
           }
           throw new AuthException("not allowed to see HEAD");
         } finally {
-          rw.release();
+          rw.close();
         }
       }
       throw new ResourceNotFoundException(Constants.HEAD);
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/ListDashboards.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/ListDashboards.java
index fbfcc8f..658cf13 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/ListDashboards.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/ListDashboards.java
@@ -100,7 +100,7 @@
         }
         return all;
       } finally {
-        rw.release();
+        rw.close();
       }
     } finally {
       git.close();
@@ -134,7 +134,7 @@
         }
       }
     } finally {
-      tw.release();
+      tw.close();
     }
     return list;
   }
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/PerformCreateProject.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/PerformCreateProject.java
index f8cd9c1..43bdd22 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/PerformCreateProject.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/PerformCreateProject.java
@@ -300,7 +300,7 @@
               + createProjectArgs.getProjectName(), e);
       throw e;
     } finally {
-      oi.release();
+      oi.close();
     }
   }
 }
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeData.java b/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeData.java
index e9266cd..f726fe3 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeData.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeData.java
@@ -466,7 +466,7 @@
         commitMessage = c.getFullMessage();
         commitFooters = c.getFooterLines();
       } finally {
-        walk.release();
+        walk.close();
       }
     } finally {
       repo.close();
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ConflictsPredicate.java b/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ConflictsPredicate.java
index 61454a8..ca958cf 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ConflictsPredicate.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ConflictsPredicate.java
@@ -138,7 +138,7 @@
               } catch (NoSuchProjectException e) {
                 throw new IllegalStateException(e);
               } finally {
-                rw.release();
+                rw.close();
               }
             } finally {
               repo.close();
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/query/change/RevWalkPredicate.java b/gerrit-server/src/main/java/com/google/gerrit/server/query/change/RevWalkPredicate.java
index fd57a44..23bbb12 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/query/change/RevWalkPredicate.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/query/change/RevWalkPredicate.java
@@ -109,7 +109,7 @@
         try {
           return match(repo, rw, args);
         } finally {
-          rw.release();
+          rw.close();
         }
       } finally {
         repo.close();
diff --git a/gerrit-server/src/main/java/gerrit/PRED_commit_edits_2.java b/gerrit-server/src/main/java/gerrit/PRED_commit_edits_2.java
index 2c7949c..cddbf1f 100644
--- a/gerrit-server/src/main/java/gerrit/PRED_commit_edits_2.java
+++ b/gerrit-server/src/main/java/gerrit/PRED_commit_edits_2.java
@@ -130,7 +130,7 @@
     } catch (IOException err) {
       throw new JavaException(this, 1, err);
     } finally {
-      reader.release();
+      reader.close();
     }
 
     return engine.fail();
@@ -161,4 +161,4 @@
     }
     return new Text(reader.open(tw.getObjectId(0), Constants.OBJ_BLOB));
   }
-}
\ No newline at end of file
+}
diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/change/IncludedInResolverTest.java b/gerrit-server/src/test/java/com/google/gerrit/server/change/IncludedInResolverTest.java
index 65eede6..1d0626c 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/server/change/IncludedInResolverTest.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/server/change/IncludedInResolverTest.java
@@ -127,7 +127,7 @@
 
   @After
   public void tearDown() throws Exception {
-    revWalk.release();
+    revWalk.close();
     super.tearDown();
   }
 
diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/notedb/ChangeNotesTest.java b/gerrit-server/src/test/java/com/google/gerrit/server/notedb/ChangeNotesTest.java
index 29d2449..4b3b206 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/server/notedb/ChangeNotesTest.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/server/notedb/ChangeNotesTest.java
@@ -218,7 +218,7 @@
       assertEquals(author.getWhen(), committer.getWhen());
       assertEquals(author.getTimeZone(), committer.getTimeZone());
     } finally {
-      walk.release();
+      walk.close();
     }
   }
 
@@ -243,7 +243,7 @@
           + "Patch-set: 1\n",
           commit.getFullMessage());
     } finally {
-      walk.release();
+      walk.close();
     }
   }
 
@@ -264,7 +264,7 @@
           + "Label: -Code-Review\n",
           commit.getFullMessage());
     } finally {
-      walk.release();
+      walk.close();
     }
   }
 
@@ -312,7 +312,7 @@
       assertEquals(author.getWhen(), committer.getWhen());
       assertEquals(author.getTimeZone(), committer.getTimeZone());
     } finally {
-      walk.release();
+      walk.close();
     }
   }
 
@@ -337,7 +337,7 @@
           + "Submitted-with: RULE_ERROR Problem with patch set: 1\n",
           commit.getFullMessage());
     } finally {
-      walk.release();
+      walk.close();
     }
   }
 
@@ -717,7 +717,7 @@
           + "Reviewer: Change Owner <1@gerrit>\n",
           commit.getFullMessage());
     } finally {
-      walk.release();
+      walk.close();
     }
 
     ChangeNotes notes = newNotes(c);
@@ -748,7 +748,7 @@
           + "Patch-set: 1\n",
           commit.getFullMessage());
     } finally {
-      walk.release();
+      walk.close();
     }
 
     ChangeNotes notes = newNotes(c);
@@ -789,7 +789,7 @@
           + "Patch-set: 1\n",
           commit.getFullMessage());
     } finally {
-      walk.release();
+      walk.close();
     }
 
     ChangeNotes notes = newNotes(c);
diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/tools/hooks/CommitMsgHookTest.java b/gerrit-server/src/test/java/com/google/gerrit/server/tools/hooks/CommitMsgHookTest.java
index 17fe068..8d41e0a 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/server/tools/hooks/CommitMsgHookTest.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/server/tools/hooks/CommitMsgHookTest.java
@@ -431,7 +431,7 @@
       oi.flush();
       return e;
     } finally {
-      oi.release();
+      oi.close();
     }
   }
 
@@ -457,7 +457,7 @@
           fail(Constants.HEAD + " did not change: " + ref.getResult());
       }
     } finally {
-      oi.release();
+      oi.close();
     }
   }
 }
diff --git a/lib/jgit/BUCK b/lib/jgit/BUCK
index dcefb64..050e1c8 100644
--- a/lib/jgit/BUCK
+++ b/lib/jgit/BUCK
@@ -1,13 +1,13 @@
 include_defs('//lib/maven.defs')
 
 REPO = MAVEN_CENTRAL # Leave here even if set to MAVEN_CENTRAL.
-VERS = '4.0.0.201505050340-m2'
+VERS = '4.0.0.201506090130-r'
 
 maven_jar(
   name = 'jgit',
   id = 'org.eclipse.jgit:org.eclipse.jgit:' + VERS,
-  bin_sha1 = '1cc3120d39ed2b55584e631634e65c5d2e6c1cf7',
-  src_sha1 = '425f578cc9d5ccb8f3b050a5ab1e2d7a0becb25d',
+  bin_sha1 = '859b5dbae0372bc0744503b9593119410c0474f2',
+  src_sha1 = '5a7b7e179852c20f6af8581b96cf6441b23025a5',
   license = 'jgit',
   repository = REPO,
   unsign = True,
@@ -22,7 +22,7 @@
 maven_jar(
   name = 'jgit-servlet',
   id = 'org.eclipse.jgit:org.eclipse.jgit.http.server:' + VERS,
-  sha1 = '2a9f55d1d92afef795542b995db6ab261007857f',
+  sha1 = 'd86da25c9e1042612ebe3be1e027cce4d9a8e4c9',
   license = 'jgit',
   repository = REPO,
   deps = [':jgit'],
@@ -36,7 +36,7 @@
 maven_jar(
   name = 'jgit-archive',
   id = 'org.eclipse.jgit:org.eclipse.jgit.archive:' + VERS,
-  sha1 = 'ee3954753067818f8f734981a01c13ac33425f2c',
+  sha1 = '3b1f5cefdd65bbe81851f638ee1f461c9cb5df20',
   license = 'jgit',
   repository = REPO,
   deps = [':jgit',
@@ -53,7 +53,7 @@
 maven_jar(
   name = 'junit',
   id = 'org.eclipse.jgit:org.eclipse.jgit.junit:' + VERS,
-  sha1 = '6cc19f8f0a1791e26d4225625ecba6a31d9b830e',
+  sha1 = 'e86c5b8ec06624d3cd2b8c11fd0c528281751329',
   license = 'DO_NOT_DISTRIBUTE',
   repository = REPO,
   unsign = True,
diff --git a/plugins/reviewnotes b/plugins/reviewnotes
index 6170241..0b5aab6 160000
--- a/plugins/reviewnotes
+++ b/plugins/reviewnotes
@@ -1 +1 @@
-Subproject commit 61702414c046dd6b811c9137b765f9db422f83db
+Subproject commit 0b5aab68206744f6a41abba63aaa3714f354fa83