Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-8473

JarListHandler may fail with NPE if directory is deleted

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.0, 1.5.0
    • Fix Version/s: 1.5.0, 1.4.1
    • Component/s: Webfrontend
    • Labels:
      None

      Description

      The JarListHandler is responsible for listing all jars that have been uploaded via the webUI. Uploaded jars are stored in a temporary directory, and the handler simply iterates over the contents of this directory to create the listing.

       

      File[] list = jarDir.listFiles(new FilenameFilter() {
         @Override
         public boolean accept(File dir, String name) {
            return name.endsWith(".jar");
         }
      });
      
      // last modified ascending order
      Arrays.sort(list, (f1, f2) -> Long.compare(f2.lastModified(), f1.lastModified()));

      This code will fail with a NullPointerException if the directory was deleted (like as part of some automatic cleanup). File#listFiles returns null in this case causing Arrays.sort to throw the NPE.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Zentol Chesnay Schepler
                Reporter:
                Zentol Chesnay Schepler
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: