Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-12614

FSPermissionChecker#getINodeAttrs() throws NPE when INodeAttributesProvider configured

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-beta1
    • Fix Version/s: 3.0.0
    • Component/s: None
    • Labels:
      None
    • Target Version/s:

      Description

      When INodeAttributesProvider is configured, and when resolving path (like "/") and checking for permission, the following code when working on pathByNameArr throws NullPointerException.

        private INodeAttributes getINodeAttrs(byte[][] pathByNameArr, int pathIdx,
            INode inode, int snapshotId) {
          INodeAttributes inodeAttrs = inode.getSnapshotINode(snapshotId);
          if (getAttributesProvider() != null) {
            String[] elements = new String[pathIdx + 1];
            for (int i = 0; i < elements.length; i++) {
              elements[i] = DFSUtil.bytes2String(pathByNameArr[i]);  <===
            }
            inodeAttrs = getAttributesProvider().getAttributes(elements, inodeAttrs);
          }
          return inodeAttrs;
        }
      

      Looks like for paths like "/" where the split components based on delimiter "/" can be null, the pathByNameArr array can have null elements and can throw NPE.

        Attachments

        1. HDFS-12614.test.01.patch
          3 kB
          Manoj Govindassamy
        2. HDFS-12614.04.patch
          5 kB
          Manoj Govindassamy
        3. HDFS-12614.03.patch
          5 kB
          Manoj Govindassamy
        4. HDFS-12614.02.patch
          5 kB
          Manoj Govindassamy
        5. HDFS-12614.01.patch
          4 kB
          Manoj Govindassamy

          Issue Links

            Activity

              People

              • Assignee:
                manojg Manoj Govindassamy
                Reporter:
                manojg Manoj Govindassamy
              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: