Hadoop HDFS
  1. Hadoop HDFS
  2. HDFS-1934

Fix NullPointerException when File.listFiles() API returns null

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.23.0
    • Fix Version/s: 0.23.0
    • Component/s: None
    • Labels:
      None

      Description

      While testing Disk Fail Inplace, We encountered the NPE from this part of the code.

      File[] files = dir.listFiles();
      for (File f : files)

      { ... }

      This is kinda of an API issue. When a disk is bad (or name is not a directory), this API (listFiles, list) return null rather than throwing an exception. This 'for loop' throws a NPE exception. And same applies to dir.list() API.

      Fix all the places where null condition was not checked.

      1. HDFS-1934-1.patch
        2 kB
        Bharath Mundlapudi
      2. HDFS-1934-2.patch
        4 kB
        Bharath Mundlapudi
      3. HDFS-1934-3.patch
        4 kB
        Bharath Mundlapudi
      4. HDFS-1934-4.patch
        4 kB
        Bharath Mundlapudi
      5. HDFS-1934-5.patch
        4 kB
        Bharath Mundlapudi

        Issue Links

          Activity

          No work has yet been logged on this issue.

            People

            • Assignee:
              Bharath Mundlapudi
              Reporter:
              Bharath Mundlapudi
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development