{
convertedInput = convertValue(getInputAsArray());
}
catch (ConversionException e)
{
ValidationError error = new ValidationError();
if (e.getResourceKey() != null)
{
error.addMessageKey(e.getResourceKey());
}
if (e.getTargetType() != null)
{
error.addMessageKey("ConversionError." + Classes.simpleName(e.getTargetType()));
}
error.addMessageKey("ConversionError");
final Locale locale = e.getLocale();
if (locale != null)
{
error.setVariable("locale", locale);
}
error.setVariable("exception", e);
Format format = e.getFormat();
if (format instanceof SimpleDateFormat)
{
error.setVariable("format", ((SimpleDateFormat)format).toLocalizedPattern());
}
error((IValidationError)error);
}
}
else
{
final IConverter converter = getConverter(getType());
try
{
convertedInput = converter.convertToObject(getInput(), getLocale());
}
catch (ConversionException e)
{
ValidationError error = new ValidationError();
if (e.getResourceKey() != null)
{
error.addMessageKey(e.getResourceKey());
}
String simpleName = Classes.simpleName(getType());
error.addMessageKey("IConverter." + simpleName);
error.addMessageKey("IConverter");
error.setVariable("type", simpleName);
final Locale locale = e.getLocale();
if (locale != null)
{
error.setVariable("locale", locale);
}
error.setVariable("exception", e);
Format format = e.getFormat();
if (format instanceof SimpleDateFormat)
{
error.setVariable("format", ((SimpleDateFormat)format).toLocalizedPattern());
}
error((IValidationError)error);
}
}