MCPcopy Index your code
hub / github.com/apache/tomcat / streamFilesForDelete

Method streamFilesForDelete

java/org/apache/juli/FileHandler.java:527–542  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

525 }
526
527 private DirectoryStream<Path> streamFilesForDelete() throws IOException {
528 LocalDate maxDaysOffset = LocalDate.now().minusDays(maxDays.intValue());
529 return Files.newDirectoryStream(getDirectoryAsPath(), path -> {
530 boolean result = false;
531 String date = obtainDateFromPath(path);
532 if (date != null) {
533 try {
534 LocalDate dateFromFile = LocalDate.from(DateTimeFormatter.ISO_LOCAL_DATE.parse(date));
535 result = dateFromFile.isBefore(maxDaysOffset);
536 } catch (DateTimeException ignore) {
537 // Unable to determine date from path. File will not be included.
538 }
539 }
540 return result;
541 });
542 }
543
544 private Path getDirectoryAsPath() {
545 return Path.of(directory);

Callers 1

cleanMethod · 0.95

Calls 4

getDirectoryAsPathMethod · 0.95
obtainDateFromPathMethod · 0.95
nowMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected