]> source.dussan.org Git - jgit.git/commitdiff
[infer] Fix SubmoduleWalk leaks in submodule commands 64/87364/4
authorMatthias Sohn <matthias.sohn@sap.com>
Sun, 18 Dec 2016 00:37:01 +0000 (01:37 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Sun, 18 Dec 2016 12:49:36 +0000 (13:49 +0100)
Bug: 509385
Change-Id: I4cba81d8ea596800a40799dc9cb763fae01fe508
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java

index 0ed02acc82d1183cae1b494de12e92db52f2217f..1dbe3681bf11d548eb605d873924c5c49ba1d5e2 100644 (file)
@@ -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();
index 968041c3a5904abed7d7c2a85324e1827452c003..a1ea790d0da6312bd6c047a6886d272f0cac82be 100644 (file)
@@ -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>();
index 024f0bebdef522c81987dbdab7a1ec5edfd75697..088eedc2dcd9604f41edc0844d8a46b61a74f710 100644 (file)
@@ -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>();