Skip to content

Commit

Permalink
Set default warn threshold for NumberFormatException
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakshan-Banneheke committed Oct 9, 2023
1 parent 8632c56 commit f9c7f75
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -622,12 +622,8 @@ private static void setReCaptchaConfigs(Properties properties) {
throw new RuntimeException(getValidationErrorMessage(CaptchaConstants.RE_CAPTCHA_SCORE_THRESHOLD));
}

try {
Double reCaptchaWarnScoreThreshold = getReCaptchaWarnThreshold(properties);
CaptchaDataHolder.getInstance().setReCaptchaWarnScoreThreshold(reCaptchaWarnScoreThreshold);
} catch (NumberFormatException e) {
throw new RuntimeException(getValidationErrorMessage(CaptchaConstants.RE_CAPTCHA_WARN_SCORE_THRESHOLD));
}
double reCaptchaWarnScoreThreshold = getReCaptchaWarnThreshold(properties);
CaptchaDataHolder.getInstance().setReCaptchaWarnScoreThreshold(reCaptchaWarnScoreThreshold);

String forcefullyEnableRecaptchaForAllTenants =
properties.getProperty(CaptchaConstants.FORCEFULLY_ENABLED_RECAPTCHA_FOR_ALL_TENANTS);
Expand Down Expand Up @@ -672,7 +668,12 @@ private static double getReCaptchaWarnThreshold(Properties properties) throws Nu
}
return CaptchaConstants.CAPTCHA_V3_DEFAULT_WARN_THRESHOLD;
}
return Double.parseDouble(warnThreshold);
try {
return Double.parseDouble(warnThreshold);
} catch (NumberFormatException e) {
log.warn("NumberFormatException for ReCaptcha warn score threshold. Using default value.");
return CaptchaConstants.CAPTCHA_V3_DEFAULT_WARN_THRESHOLD;
}
}

private static void setSSOLoginConnectorConfigs(Properties properties) {
Expand Down

0 comments on commit f9c7f75

Please sign in to comment.