Skip to content

Commit

Permalink
FileTools: fix logic in finding oldest modified dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
aziemchawdhary-gs committed Jan 31, 2024
1 parent 46c4927 commit bd90a55
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public static Optional<Path> findOldestModified(Path... directory) throws IOExce
{
directory = Arrays.asList(directory)
.stream()
.filter(x -> x == null)
.filter(x -> x != null)
.collect(Collectors.toList()).toArray(new Path[]{});

if (directory.length == 0)
Expand Down Expand Up @@ -208,7 +208,7 @@ public static Optional<Path> findOldestModified(Path directory, Predicate<Path>
final AtomicLong minModifiedTime = new AtomicLong(0);
final AtomicReference<Path> minModifiedPath = new AtomicReference<>();

if (Files.exists(directory))
if (directory != null && Files.exists(directory))
{
Files.walkFileTree(Paths.get(directory.toAbsolutePath().toString()), new SimpleFileVisitor<Path>()
{
Expand Down

0 comments on commit bd90a55

Please sign in to comment.