Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Uses default error key if specified key doesn't exist
Loading branch information
@@ -120,7 +120,11 @@ protected String buildErrorMessage(Throwable e, Object[] args) {
if (LOG . isDebugEnabled()) {
LOG . debug(" Preparing error message for key: [#0]" , errorKey);
}
return LocalizedTextUtil . findText(this . getClass(), errorKey, defaultLocale, e. getMessage(), args);
if (LocalizedTextUtil . findText(this . getClass(), errorKey, defaultLocale, null , new Object [0 ]) == null ) {
return LocalizedTextUtil . findText(this . getClass(), " struts.messages.error.uploading" , defaultLocale, null , new Object [] { e. getMessage() });
} else {
return LocalizedTextUtil . findText(this . getClass(), errorKey, defaultLocale, null , args);
}
}
protected void processUpload (HttpServletRequest request , String saveDir ) throws FileUploadException , UnsupportedEncodingException {
@@ -539,7 +539,11 @@ private String buildErrorMessage(Throwable e, Object[] args) {
String errorKey = " struts.message.upload.error." + e. getClass(). getSimpleName();
if (LOG . isDebugEnabled())
LOG . debug(" Preparing error message for key: [#0]" , errorKey);
return LocalizedTextUtil . findText(this . getClass(), errorKey, defaultLocale, e. getMessage(), args);
if (LocalizedTextUtil . findText(this . getClass(), errorKey, defaultLocale, null , new Object [0 ]) == null ) {
return LocalizedTextUtil . findText(this . getClass(), " struts.messages.error.uploading" , defaultLocale, null , new Object [] { e. getMessage() });
} else {
return LocalizedTextUtil . findText(this . getClass(), errorKey, defaultLocale, null , args);
}
}
/**
@@ -108,7 +108,11 @@ protected String buildErrorMessage(Throwable e, Object[] args) {
if (LOG . isDebugEnabled()) {
LOG . debug(" Preparing error message for key: [#0]" , errorKey);
}
return LocalizedTextUtil . findText(this . getClass(), errorKey, defaultLocale, e. getMessage(), args);
if (LocalizedTextUtil . findText(this . getClass(), errorKey, getLocale(), null , new Object [0 ]) == null ) {
return LocalizedTextUtil . findText(this . getClass(), " struts.messages.error.uploading" , defaultLocale, null , new Object [] { e. getMessage() });
} else {
return LocalizedTextUtil . findText(this . getClass(), errorKey, defaultLocale, null , args);
}
}
/**
Toggle all file notes
This comment has been minimized.
3523064
hello:
You can also add a filter before StrutsPrepareAndExecuteFilter in web.xml, Just make a simple judgment in the filter, if there are illegal characters exists on Content-Type, Don't call StrutsPrepareAndExecuteFilter.