aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2015-04-04 00:38:39 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2015-04-04 00:38:39 +0200
commit1728d1d760154afafa99706b5169c9656d40a428 (patch)
tree33eab6bf19d346990f307483d354865218a0169c /org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java
parent81c84c088f85e5babe73e1799fe786bf32750a5a (diff)
downloadjgit-1728d1d760154afafa99706b5169c9656d40a428.tar.gz
jgit-1728d1d760154afafa99706b5169c9656d40a428.zip
Use try-with-resource to close resources in ObjectDatabase
Change-Id: Ib410bf0d3c300c25b615bb6a51488b3d88aeb3bd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java10
1 files changed, 2 insertions, 8 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java
index 0cc51d1a52..2abd6dae61 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java
@@ -120,11 +120,8 @@ public abstract class ObjectDatabase {
* the object store cannot be accessed.
*/
public boolean has(final AnyObjectId objectId) throws IOException {
- final ObjectReader or = newReader();
- try {
+ try (final ObjectReader or = newReader()) {
return or.has(objectId);
- } finally {
- or.release();
}
}
@@ -172,11 +169,8 @@ public abstract class ObjectDatabase {
public ObjectLoader open(AnyObjectId objectId, int typeHint)
throws MissingObjectException, IncorrectObjectTypeException,
IOException {
- final ObjectReader or = newReader();
- try {
+ try (final ObjectReader or = newReader()) {
return or.open(objectId, typeHint);
- } finally {
- or.release();
}
}