Skip to content

Commit a6f2ae2

Browse files
committed
ensure list of files is non-null
1 parent 07807f9 commit a6f2ae2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

opengrok-web/src/test/java/org/opengrok/web/PageConfigTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.util.Arrays;
3535
import java.util.List;
3636
import java.util.Map;
37+
import java.util.Objects;
3738
import java.util.stream.Collectors;
3839
import java.util.stream.Stream;
3940

@@ -182,7 +183,7 @@ void testGetResourceFileList() {
182183
env.setProjectsEnabled(true);
183184

184185
// Enable projects.
185-
for (String file : new File(repository.getSourceRoot()).list()) {
186+
for (String file : Objects.requireNonNull(new File(repository.getSourceRoot()).list())) {
186187
Project proj = new Project(file);
187188
proj.setIndexed(true);
188189
env.getProjects().put(file, proj);
@@ -245,7 +246,8 @@ void testGetSortedFilesDirsFirst() throws IOException {
245246

246247
// Make sure the source root has just directories.
247248
File sourceRootFile = new File(repository.getSourceRoot());
248-
assertTrue(Arrays.stream(sourceRootFile.listFiles()).filter(File::isFile).
249+
assertTrue(Arrays.stream(Objects.requireNonNull(sourceRootFile.listFiles())).
250+
filter(File::isFile).
249251
collect(Collectors.toSet()).isEmpty());
250252

251253
// Create regular file under source root.

0 commit comments

Comments
 (0)