fixed MessageFormat.format for messages without arguments

removed duplicage entry from property file
This commit is contained in:
patrick-werner 2020-03-01 22:22:52 +01:00
parent 446c9462a0
commit ba5eea6774
4 changed files with 9 additions and 5 deletions

View File

@ -53,6 +53,7 @@ POSSIBILITY OF SUCH DAMAGE.
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.List; import java.util.List;
import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.dstu3.model.Resource; import org.hl7.fhir.dstu3.model.Resource;
@ -151,7 +152,12 @@ public class BaseValidator {
if (theMessageArguments != null && theMessageArguments.length > 0) { if (theMessageArguments != null && theMessageArguments.length > 0) {
message = MessageFormat.format(messages.getString(theMessage), theMessageArguments); message = MessageFormat.format(messages.getString(theMessage), theMessageArguments);
} else { } else {
message = theMessage; try {
message = messages.getString(theMessage);
} catch (MissingResourceException e) {
// non-internationalized String
message = theMessage;
}
} }
return message; return message;
} }

View File

@ -1818,7 +1818,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
warning(errors, IssueType.INVALID, e.line(), e.col(), path, yearIsValid(e.primitiveValue()), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_DATETIME_REASONABLE, e.primitiveValue()); warning(errors, IssueType.INVALID, e.line(), e.col(), path, yearIsValid(e.primitiveValue()), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_DATETIME_REASONABLE, e.primitiveValue());
rule(errors, IssueType.INVALID, e.line(), e.col(), path, rule(errors, IssueType.INVALID, e.line(), e.col(), path,
e.primitiveValue() e.primitiveValue()
.matches("([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)?)?)?"), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_DATETIME_VALID); .matches("([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)?)?)?"), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_DATETIME_VALID, e.primitiveValue());
rule(errors, IssueType.INVALID, e.line(), e.col(), path, !hasTime(e.primitiveValue()) || hasTimeZone(e.primitiveValue()), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_DATETIME_TZ); rule(errors, IssueType.INVALID, e.line(), e.col(), path, !hasTime(e.primitiveValue()) || hasTimeZone(e.primitiveValue()), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_DATETIME_TZ);
rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength() == 0 || e.primitiveValue().length() <= context.getMaxLength(), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_LENGTH, context.getMaxLength()); rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength() == 0 || e.primitiveValue().length() <= context.getMaxLength(), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_LENGTH, context.getMaxLength());
try { try {

View File

@ -166,7 +166,6 @@ Terminology_TX_ValueSet_NotFound2 = ValueSet {0} not found by validator
Type_Specific_Checks_DT_Base64_Valid = The value '{0}' is not a valid Base64 value Type_Specific_Checks_DT_Base64_Valid = The value '{0}' is not a valid Base64 value
Type_Specific_Checks_DT_Boolean_Value = boolean values must be 'true' or 'false' Type_Specific_Checks_DT_Boolean_Value = boolean values must be 'true' or 'false'
Type_Specific_Checks_DT_Code_WS = The code '{0}' is not valid (whitespace rules) Type_Specific_Checks_DT_Code_WS = The code '{0}' is not valid (whitespace rules)
Type_Specific_Checks_DT_DateTIme_Valid = Not a valid date time
Type_Specific_Checks_DT_DateTime_Reasonable = The value '{0}' is outside the range of reasonable years - check for data entry error Type_Specific_Checks_DT_DateTime_Reasonable = The value '{0}' is outside the range of reasonable years - check for data entry error
Type_Specific_Checks_DT_DateTime_Regex = The instant '{0}' is not valid (by regex) Type_Specific_Checks_DT_DateTime_Regex = The instant '{0}' is not valid (by regex)
Type_Specific_Checks_DT_DateTime_TZ = if a date has a time, it must have a timezone Type_Specific_Checks_DT_DateTime_TZ = if a date has a time, it must have a timezone

View File

@ -166,7 +166,6 @@ Terminology_TX_ValueSet_NotFound2 = ValueSet {0} not found by validator
Type_Specific_Checks_DT_Base64_Valid = The value '{0}' is not a valid Base64 value Type_Specific_Checks_DT_Base64_Valid = The value '{0}' is not a valid Base64 value
Type_Specific_Checks_DT_Boolean_Value = boolean values must be 'true' or 'false' Type_Specific_Checks_DT_Boolean_Value = boolean values must be 'true' or 'false'
Type_Specific_Checks_DT_Code_WS = The code '{0}' is not valid (whitespace rules) Type_Specific_Checks_DT_Code_WS = The code '{0}' is not valid (whitespace rules)
Type_Specific_Checks_DT_DateTIme_Valid = Not a valid date time
Type_Specific_Checks_DT_DateTime_Reasonable = The value '{0}' is outside the range of reasonable years - check for data entry error Type_Specific_Checks_DT_DateTime_Reasonable = The value '{0}' is outside the range of reasonable years - check for data entry error
Type_Specific_Checks_DT_DateTime_Regex = The instant '{0}' is not valid (by regex) Type_Specific_Checks_DT_DateTime_Regex = The instant '{0}' is not valid (by regex)
Type_Specific_Checks_DT_DateTime_TZ = if a date has a time, it must have a timezone Type_Specific_Checks_DT_DateTime_TZ = if a date has a time, it must have a timezone