@Override
    public String validate(String value) {
      if (value == null) return null;
      final Path path = FileSystems.getDefault().getPath(value);
      if (path == null) {
        return "Path '%s' provided could not be located.".formatted(value);
      } else {
        final boolean isDir = Files.isDirectory(path);
        final boolean isWritable = Files.isWritable(path);
        if (!isDir) {
          return "Path '%s' provided is not a directory.".formatted(value);
        }
        if (!isWritable) {
          return "Path '%s' provided is not writable.".formatted(value);
        }
        return null;
      }
    }
validate value for a ConfVar, return non-null string for fail message
common/src/java/org/apache/hadoop/hive/conf/Validator.java