code: private void verifyParentDir(String src) throws FileAlreadyExistsException,
        FileNotFoundException {
      Path parent = new Path(src).getParent();
      if (parent != null) {
        INode[] pathINodes = dir.getExistingPathINodes(parent.toString());
        if (pathINodes[pathINodes.length - 1] == null) {
          throw new FileNotFoundException("Parent directory doesn't exist: "
              + parent.toString());
        } else if (!pathINodes[pathINodes.length - 1].isDirectory()) {
          throw new FileAlreadyExistsException("Parent path is not a directory: "
              + parent.toString());
        }
      }
    }
docs: /*
  Verify that parent dir exists