Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8232280

close() is not called on return value of Files.walk()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • internal
    • internal
    • tools
    • generic
    • generic

      Files.walk() is misused. It is used just as `Files.walk(...)`, however to avoid resource leak it should be used as:
      try (var paths = Files.walk()) {
          paths...
      }

      Need to wrap all Files.walk() calls in try-with-resource statements.

            herrick Andy Herrick (Inactive)
            asemenyuk Alexey Semenyuk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: