aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2016-01-19 13:08:38 -0800
committerShawn Pearce <spearce@spearce.org>2016-01-19 14:27:11 -0800
commit6b662af76ef66cd75502ace714302d3a36129ed1 (patch)
treed6cf409098b24da1108b569a2dcccfd3ee418199 /org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java
parenteadfcd3ec166c55c1ff3f3fe0b5e97dd94ff8d83 (diff)
downloadjgit-6b662af76ef66cd75502ace714302d3a36129ed1.tar.gz
jgit-6b662af76ef66cd75502ace714302d3a36129ed1.zip
Transport: Implement AutoCloseable
After creating a Transport instance callers should always call its close() method. Use AutoCloseable to document this idiom and allow use of try-with-resources. Change-Id: I0c6ff3e39ebecdd7a028dbcae1856a818937b186
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java
index ba89d2d616..f94f707258 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java
@@ -166,8 +166,10 @@ public class BundleWriterTest extends SampleDataRepositoryTestCase {
final ByteArrayInputStream in = new ByteArrayInputStream(bundle);
final RefSpec rs = new RefSpec("refs/heads/*:refs/heads/*");
final Set<RefSpec> refs = Collections.singleton(rs);
- return new TransportBundleStream(newRepo, uri, in).fetch(
- NullProgressMonitor.INSTANCE, refs);
+ try (TransportBundleStream transport = new TransportBundleStream(
+ newRepo, uri, in)) {
+ return transport.fetch(NullProgressMonitor.INSTANCE, refs);
+ }
}
private byte[] makeBundle(final String name,