allow empty string as date value nil
This commit is contained in:
parent
0f6b43605d
commit
81d34d4e19
@ -27,11 +27,14 @@ public class DefaultDateParameterMapMapper implements ParameterMapMapper<Date> {
|
||||
if (value instanceof Date) {
|
||||
return (Date) value;
|
||||
}
|
||||
if (value instanceof String && ((String) value).trim().length() == 0) {
|
||||
try {
|
||||
return DateUtil.DEFAULT_DATEFORMAT.parse((String) value);
|
||||
} catch (ParseException e) {
|
||||
throw new UserException(new UserError(UserError.MSG_INVALID_DATEFORMAT, propertyName, (String) value));
|
||||
if (value instanceof String) {
|
||||
final String valueAsString = ((String) value).trim();
|
||||
if (valueAsString.length() > 0) {
|
||||
try {
|
||||
return DateUtil.DEFAULT_DATEFORMAT.parse(valueAsString);
|
||||
} catch (ParseException e) {
|
||||
throw new UserException(new UserError(UserError.MSG_INVALID_DATEFORMAT, propertyName, valueAsString));
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user