Fixed DateFormatValidator to handle placeholders SHORT and MEDIUM

This commit is contained in:
cketti 2011-09-30 16:54:01 +02:00
parent cd72e197ec
commit 6e1bf2965d
1 changed files with 7 additions and 0 deletions

View File

@ -191,6 +191,13 @@ public class GlobalSettings {
@Override
public boolean isValid(String key, String value, Map<String, String> validatedSettings) {
try {
// The placeholders "SHORT" and "MEDIUM" are fine.
if (DateFormatter.SHORT_FORMAT.equals(value) ||
DateFormatter.MEDIUM_FORMAT.equals(value)) {
return true;
}
// If the SimpleDateFormat constructor doesn't throw an exception, we're good.
new SimpleDateFormat(value);
return true;
} catch (Exception e) {