]> source.dussan.org Git - jgit.git/commitdiff
LocalDiskRepositoryTestCase: Prevent duplicates in list of repos to close 61/89661/1
authorDavid Pursehouse <david.pursehouse@gmail.com>
Fri, 27 Jan 2017 02:32:18 +0000 (11:32 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Fri, 27 Jan 2017 07:00:06 +0000 (16:00 +0900)
Change the "toClose" list to a set, which will not allow duplicate
entries. This reduces the number of false positive logs about corrupt
use count due to the same repository being closed more than once during
teardown.

Change-Id: I5ab0ff8b56e7f2b2c7aab5274d957708d26f42c5
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java

index dc2e8bfb71406f202fbc3ccc440167beb8bc6592..0a6defc3e250bc60e8e30e8de296fafaa6b9d87e 100644 (file)
@@ -53,8 +53,10 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.TreeSet;
 
 import org.eclipse.jgit.dircache.DirCache;
@@ -106,7 +108,7 @@ public abstract class LocalDiskRepositoryTestCase {
         */
        protected MockSystemReader mockSystemReader;
 
-       private final List<Repository> toClose = new ArrayList<Repository>();
+       private final Set<Repository> toClose = new HashSet<>();
        private File tmp;
 
        @Before