code: private void checkDirectory(String d) {
      if (!d.startsWith(Path.SEPARATOR)) {
        throw new IllegalArgumentException("Bad directory:" + d);
      }
      if (d.endsWith(Path.SEPARATOR)) {
        throw new IllegalArgumentException("Bad directory:" + d);
      }
    }
docs: Make sure the direcotry string has the format "/a/b/c"