aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2015-04-02 01:24:05 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2015-04-02 01:24:05 +0200
commit9e37f6d1442ee306190f8f85019e76d77e8ac417 (patch)
treeca5d2efc0ebaba7aa503cc4802a59e4da753102d /org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java
parentd94ce9c754b740defbd75230663d323f64cc9648 (diff)
downloadjgit-9e37f6d1442ee306190f8f85019e76d77e8ac417.tar.gz
jgit-9e37f6d1442ee306190f8f85019e76d77e8ac417.zip
Use try-with-resource to close resources in BundleFetchConnection
Change-Id: Id79c01133b835e278d5b494b5bc5972d7aeed9a9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java10
1 files changed, 2 insertions, 8 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java
index e3cfd22adb..e53c04b535 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java
@@ -183,16 +183,13 @@ class BundleFetchConnection extends BaseFetchConnection {
throws TransportException {
verifyPrerequisites();
try {
- ObjectInserter ins = transport.local.newObjectInserter();
- try {
+ try (ObjectInserter ins = transport.local.newObjectInserter()) {
PackParser parser = ins.newPackParser(bin);
parser.setAllowThin(true);
parser.setObjectChecker(transport.getObjectChecker());
parser.setLockMessage(lockMessage);
packLock = parser.parse(NullProgressMonitor.INSTANCE);
ins.flush();
- } finally {
- ins.release();
}
} catch (IOException err) {
close();
@@ -217,8 +214,7 @@ class BundleFetchConnection extends BaseFetchConnection {
if (prereqs.isEmpty())
return;
- final RevWalk rw = new RevWalk(transport.local);
- try {
+ try (final RevWalk rw = new RevWalk(transport.local)) {
final RevFlag PREREQ = rw.newFlag("PREREQ"); //$NON-NLS-1$
final RevFlag SEEN = rw.newFlag("SEEN"); //$NON-NLS-1$
@@ -281,8 +277,6 @@ class BundleFetchConnection extends BaseFetchConnection {
throw new MissingBundlePrerequisiteException(transport.uri,
missing);
}
- } finally {
- rw.release();
}
}