Merge "Use try-with-resource to close resources in ObjectDatabase"
This commit is contained in:
commit
67568ee630
|
@ -120,11 +120,8 @@ public void create() throws IOException {
|
||||||
* the object store cannot be accessed.
|
* the object store cannot be accessed.
|
||||||
*/
|
*/
|
||||||
public boolean has(final AnyObjectId objectId) throws IOException {
|
public boolean has(final AnyObjectId objectId) throws IOException {
|
||||||
final ObjectReader or = newReader();
|
try (final ObjectReader or = newReader()) {
|
||||||
try {
|
|
||||||
return or.has(objectId);
|
return or.has(objectId);
|
||||||
} finally {
|
|
||||||
or.release();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,11 +169,8 @@ public ObjectLoader open(final AnyObjectId objectId)
|
||||||
public ObjectLoader open(AnyObjectId objectId, int typeHint)
|
public ObjectLoader open(AnyObjectId objectId, int typeHint)
|
||||||
throws MissingObjectException, IncorrectObjectTypeException,
|
throws MissingObjectException, IncorrectObjectTypeException,
|
||||||
IOException {
|
IOException {
|
||||||
final ObjectReader or = newReader();
|
try (final ObjectReader or = newReader()) {
|
||||||
try {
|
|
||||||
return or.open(objectId, typeHint);
|
return or.open(objectId, typeHint);
|
||||||
} finally {
|
|
||||||
or.release();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue