소스 검색

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 년 전
부모
커밋
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();
}
}


Loading…
취소
저장