public static String maskPasswordInPropertyMap(String propertyMap) {
    if (null == propertyMap) {
      return null;
    }
    final Map<String, String> map = gson.fromJson(propertyMap, new TypeToken<Map<String, String>>() {}.getType());
    return gson.toJson(maskPasswordInPropertyMap(map));
  }
Helper function to mask a string of property bags that may contain a property with a password.
@param propertyMap Property map to mask by replacing any passwords with the text "SECRET"
@return New string with the passwords masked, or null if the property map is null.
ambari-server/src/main/java/org/apache/ambari/server/utils/SecretReference.java