aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src')
-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();
}
}