private boolean fileExistsAndCanBeRead(String filePath) {
    final File passwordFile = new File(filePath);
    return passwordFile.exists() && passwordFile.canRead() && passwordFile.isFile();
  }
Reading password from the given password file

@param filePath
         the path of the file to read the password from
@param defaultPassword
         the default password this function returns in case the given
         <code>filePath</code> is <code>blank</code> or the password file
         cannot be read for any reason
@return the password found in the given password file or
        <code>defaultPassword</code> if the given path is <code>blank</code>
        or cannot be read for any reason
@throws RuntimeException
          when any error occurred while reading the password file
ambari-server/src/main/java/org/apache/ambari/server/utils/PasswordUtils.java