aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/api
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2016-12-18 01:37:01 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2016-12-18 13:49:36 +0100
commitaa199ff648a3b683ce128c3293d4f529bac6864b (patch)
tree61e8be193564c02b5c7ae53682a58b8791ece4f4 /org.eclipse.jgit/src/org/eclipse/jgit/api
parentfbcc2cb4ca6b1732e28edeb766b8d57e2de560ce (diff)
downloadjgit-aa199ff648a3b683ce128c3293d4f529bac6864b.tar.gz
jgit-aa199ff648a3b683ce128c3293d4f529bac6864b.zip
[infer] Fix SubmoduleWalk leaks in submodule commands
Bug: 509385 Change-Id: I4cba81d8ea596800a40799dc9cb763fae01fe508 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java3
3 files changed, 3 insertions, 6 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java
index 0ed02acc82..1dbe3681bf 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java
@@ -94,8 +94,7 @@ public class SubmoduleInitCommand extends GitCommand<Collection<String>> {
public Collection<String> call() throws GitAPIException {
checkCallable();
- try {
- SubmoduleWalk generator = SubmoduleWalk.forIndex(repo);
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(repo)) {
if (!paths.isEmpty())
generator.setFilter(PathFilterGroup.createFromStrings(paths));
StoredConfig config = repo.getConfig();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java
index 968041c3a5..a1ea790d0d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java
@@ -94,8 +94,7 @@ public class SubmoduleStatusCommand extends
public Map<String, SubmoduleStatus> call() throws GitAPIException {
checkCallable();
- try {
- SubmoduleWalk generator = SubmoduleWalk.forIndex(repo);
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(repo)) {
if (!paths.isEmpty())
generator.setFilter(PathFilterGroup.createFromStrings(paths));
Map<String, SubmoduleStatus> statuses = new HashMap<String, SubmoduleStatus>();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java
index 024f0bebde..088eedc2dc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java
@@ -111,8 +111,7 @@ public class SubmoduleSyncCommand extends GitCommand<Map<String, String>> {
public Map<String, String> call() throws GitAPIException {
checkCallable();
- try {
- SubmoduleWalk generator = SubmoduleWalk.forIndex(repo);
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(repo)) {
if (!paths.isEmpty())
generator.setFilter(PathFilterGroup.createFromStrings(paths));
Map<String, String> synced = new HashMap<String, String>();