]> source.dussan.org Git - jgit.git/commitdiff
[spotbugs] Fix potential NPE in GcPruneNonReferencedTest 65/173365/4
authorMatthias Sohn <matthias.sohn@sap.com>
Thu, 3 Dec 2020 00:49:18 +0000 (01:49 +0100)
committerChristian Halstrick <christian.halstrick@sap.com>
Thu, 17 Dec 2020 17:41:52 +0000 (18:41 +0100)
File#listFiles can return null, assert it is not null to fix the
warning.

Change-Id: I28fc668fee760d39965e6e039003ac9f85fd461b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPruneNonReferencedTest.java

index 796df3db064cc9839731de30a1e93da09497e8dd..7386621204a545e669c887a03f5f18ef8027216c 100644 (file)
@@ -12,6 +12,7 @@ package org.eclipse.jgit.internal.storage.file;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
@@ -89,6 +90,7 @@ public class GcPruneNonReferencedTest extends GcTestCase {
 
        private void assertNoEmptyFanoutDirectories() {
                File[] fanout = repo.getObjectsDirectory().listFiles();
+               assertNotNull(fanout);
                for (File f : fanout) {
                        if (f.isDirectory()) {
                                String[] entries = f.list();