public static LdapUsernameCollisionHandlingBehavior translate(String value, LdapUsernameCollisionHandlingBehavior defaultValue) {
      String processedValue = StringUtils.upperCase(StringUtils.trim(value));

      if (StringUtils.isEmpty(processedValue)) {
        return defaultValue;
      } else {
        try {
          return valueOf(processedValue);
        } catch (IllegalArgumentException e) {
          LOG.warn("Invalid LDAP username collision value ({}), using the default value ({})", value, defaultValue.name().toLowerCase());
          return defaultValue;
        }
      }
    }
Safely translates a user-supplied behavior name to a {@link LdapUsernameCollisionHandlingBehavior}.
<p>
If the user-supplied value is empty or invalid, the default value is returned.

@param value        a user-supplied behavior name value
@param defaultValue the default value
@return a {@link LdapUsernameCollisionHandlingBehavior}
ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java