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

          Gavin made changes -
          Link This issue is depended upon by HDFS-2023 [ HDFS-2023 ]
          Gavin made changes -
          Link This issue blocks HDFS-2023 [ HDFS-2023 ]
          Arun C Murthy made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Matt Foley made changes -
          Link This issue blocks HDFS-2023 [ HDFS-2023 ]
          Matt Foley made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Matt Foley made changes -
          Link This issue is blocked by HADOOP-7322 [ HADOOP-7322 ]
          Matt Foley made changes -
          Summary Fix NullPointerException when certain File APIs return null Fix NullPointerException when File.listFiles() API returns null
          Bharath Mundlapudi made changes -
          Attachment HDFS-1934-5.patch [ 12481005 ]
          Bharath Mundlapudi made changes -
          Attachment HDFS-1934-4.patch [ 12480683 ]
          Bharath Mundlapudi made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Bharath Mundlapudi made changes -
          Attachment HDFS-1934-3.patch [ 12480631 ]
          Bharath Mundlapudi made changes -
          Attachment HDFS-1934-2.patch [ 12480576 ]
          Bharath Mundlapudi made changes -
          Attachment HDFS-1934-1.patch [ 12480568 ]
          Bharath Mundlapudi made changes -
          Fix Version/s 0.20.205.0 [ 12316392 ]
          Affects Version/s 0.20.205.0 [ 12316392 ]
          Bharath Mundlapudi made changes -
          Field Original Value New Value
          Link This issue is related to HADOOP-7125 [ HADOOP-7125 ]
          Bharath Mundlapudi created 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