if (wre.getCause() == null || !(wre.getCause() instanceof FileUploadException))
{
throw wre;
}
FileUploadException e = (FileUploadException)wre.getCause();
// Create model with exception and maximum size values
final Map model = new HashMap();
model.put("exception", e);
model.put("maxSize", getMaxSize());
if (e instanceof SizeLimitExceededException)
{
// Resource key should be <form-id>.uploadTooLarge to
// override default message
final String defaultValue = "Upload must be less than " + getMaxSize();
String msg = getString(getId() + "." + UPLOAD_TOO_LARGE_RESOURCE_KEY, Model
.valueOf(model), defaultValue);
error(msg);
if (log.isDebugEnabled())
{
log.error(msg, e);
}
else
{
log.error(msg);
}
}
else
{
// Resource key should be <form-id>.uploadFailed to override
// default message
final String defaultValue = "Upload failed: " + e.getLocalizedMessage();
String msg = getString(getId() + "." + UPLOAD_FAILED_RESOURCE_KEY, Model
.valueOf(model), defaultValue);
error(msg);
log.error(msg, e);