diff options
author | Zhen Chen <czhen@google.com> | 2016-11-22 11:59:32 -0800 |
---|---|---|
committer | Zhen Chen <czhen@google.com> | 2016-11-22 12:00:42 -0800 |
commit | 5af3f9bd638318a26cd0192097481169cfc2dfc1 (patch) | |
tree | d5c0d5280f2e68bca0bd09006564305d5c3aa65c /org.eclipse.jgit | |
parent | 81f9c18433f9d53a64498b07c90c4fc73654d942 (diff) | |
download | jgit-5af3f9bd638318a26cd0192097481169cfc2dfc1.tar.gz jgit-5af3f9bd638318a26cd0192097481169cfc2dfc1.zip |
Close input stream after use
The InputStream in FileStream in downloadPack is never closed.
Change-Id: I59975d0b8d51f4b3e3ba9d4496b254d508cb936d
Signed-off-by: Zhen Chen <czhen@google.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java index c90cadf7b6..13d4a24b02 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java @@ -881,13 +881,17 @@ class WalkFetchConnection extends BaseFetchConnection { void downloadPack(final ProgressMonitor monitor) throws IOException { String name = "pack/" + packName; //$NON-NLS-1$ WalkRemoteObjectDatabase.FileStream s = connection.open(name); - PackParser parser = inserter.newPackParser(s.in); - parser.setAllowThin(false); - parser.setObjectChecker(objCheck); - parser.setLockMessage(lockMessage); - PackLock lock = parser.parse(monitor); - if (lock != null) - packLocks.add(lock); + try { + PackParser parser = inserter.newPackParser(s.in); + parser.setAllowThin(false); + parser.setObjectChecker(objCheck); + parser.setLockMessage(lockMessage); + PackLock lock = parser.parse(monitor); + if (lock != null) + packLocks.add(lock); + } finally { + s.in.close(); + } } } } |