always check for contained key

This commit is contained in:
patrick-werner 2020-03-01 22:51:57 +01:00
parent ca6d92c390
commit b626f5867b
1 changed files with 7 additions and 5 deletions

View File

@ -145,11 +145,13 @@ public class BaseValidator {
protected String formatMessage(String theMessage, Object... theMessageArguments) {
String message;
if (theMessageArguments != null && theMessageArguments.length > 0) {
message = MessageFormat.format(messages.getString(theMessage), theMessageArguments);
} else if (messages.containsKey(theMessage)) {
message = messages.getString(theMessage);
String message = "";
if (messages.containsKey(theMessage)) {
if (theMessageArguments != null && theMessageArguments.length > 0) {
message = MessageFormat.format(messages.getString(theMessage), theMessageArguments);
} else if (messages.containsKey(theMessage)) {
message = messages.getString(theMessage);
}
} else {
message = theMessage;
}