mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Valery Kharseko
14 hours ago 4c7057e45ba8a2f3bc1f0b02b3edf14886fd1956
opendj-server-legacy/src/main/java/org/opends/quicksetup/util/Utils.java
@@ -1838,6 +1838,35 @@
    cmdLines.add(cmdReplicationServer);
    return cmdLines;
  }
  /**
   * Returns the number held by the provided field value, or the provided default value if it does
   * not hold a number.
   * <p>
   * The panels validate their fields before using their values, so the default value is only
   * returned when a field has not been validated beforehand.
   *
   * @param value
   *          the value to be parsed, which may be {@code null}
   * @param defaultValue
   *          the value to return when {@code value} does not hold a number
   * @return the number held by the provided value
   */
  public static int parseIntOrDefault(String value, int defaultValue)
  {
    if (value == null)
    {
      return defaultValue;
    }
    try
    {
      return Integer.parseInt(value.trim());
    }
    catch (NumberFormatException e)
    {
      return defaultValue;
    }
  }
}
/**