]> source.dussan.org Git - jgit.git/commit
RepoCommand#readFile: Don't call Git#getRepository() in try-with-resource 66/89666/2
authorDavid Pursehouse <david.pursehouse@gmail.com>
Fri, 27 Jan 2017 05:44:14 +0000 (14:44 +0900)
committerMatthias Sohn <matthias.sohn@sap.com>
Sat, 28 Jan 2017 16:46:28 +0000 (17:46 +0100)
commitacc94c475a4d2635584798d43a3e47a81b2b2751
tree7613d49e19312385a2c0ad4ad8c9bc5d169b15f3
parent883856110c294cd3e33d5558d4dc476d563edfe8
RepoCommand#readFile: Don't call Git#getRepository() in try-with-resource

Using try-with-resource means that close() will automatically be
called on the Repository object. However, according to the javadoc
of Git#close():

  If the repository was opened by a static factory method in this class,
  then this method calls Repository#close() on the underlying repository
  instance.

This means that Repository#close() is called twice, by Git.close()
and in the outer try-with-resource, leading to a corrupt use count.

Change-Id: I37ba517eb2cc67d1cd36813598772c70208d0bc9
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java