Просмотр исходного кода

Use try-with-resource to close resources in ObjectDatabase

Change-Id: Ib410bf0d3c300c25b615bb6a51488b3d88aeb3bd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
tags/v4.0.0.201505050340-m2
Matthias Sohn 9 лет назад
Родитель
Сommit
1728d1d760
1 измененных файлов: 2 добавлений и 8 удалений
  1. 2
    8
      org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java

+ 2
- 8
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();
}
}


Загрузка…
Отмена
Сохранить