Re: [7.0.0-M3] Error message
"Burton Rhodes" <[email protected]>
| Newsgroups | gmane.comp.jakarta.struts.devel |
|---|---|
| Message-ID | <[email protected]> |
I haven't had time yet, but I will try this weekend. ------ Original Message ------ From "Lukasz Lenart" <[email protected]> To "Struts Developers List" <[email protected]> Date 2/9/2024 9:18:45 AM Subject Re: [7.0.0-M3] Error message >Have you found a solution to this problem? I can take a look during the weekend > >pon., 5 lut 2024 o 16:51 Burton Rhodes <[email protected]> napisał(a): >> >> When catching a FileUploadException in the >> AbstractMultiPartRequest.parse() method, if the final "else" is reached, >> the default message >> "struts.messages.upload.error.FileUploadException=Error uploading: {0}!" >> (struts-messages.properties) always displays the "{0}" instead of >> replacing it with the actual filename. In looking at the code, it might >> be difficult to bubble up the filename from the source of the exception, >> but that would be the preferred solution. Otherwise, it might make >> sense to change the default upload error message without the {0} >> parameters (e.g. "Error uploading the file", or "Error parsing the >> request."). Thoughts? >> >> >> [AbstractMultiPartRequest.java] >> >> public void parse(HttpServletRequest request, String saveDir) throws >> IOException { >> try { >> processUpload(request, saveDir); >> } catch (FileUploadException e) { >> LOG.debug("Request exceeded size limit!", e); >> LocalizedMessage errorMessage; >> if (e instanceof FileUploadByteCountLimitException ex) { >> errorMessage = buildErrorMessage(e, new Object[]{ >> ex.getFieldName(), ex.getFileName(), >> ex.getPermitted(), ex.getActualSize() >> }); >> } else if (e instanceof FileUploadFileCountLimitException >> ex) { >> errorMessage = buildErrorMessage(e, new Object[]{ >> ex.getPermitted(), ex.getActualSize() >> }); >> } else if (e instanceof FileUploadSizeException ex) { >> errorMessage = buildErrorMessage(e, new Object[]{ >> ex.getPermitted(), ex.getActualSize() >> }); >> } else if (e instanceof FileUploadContentTypeException ex) { >> errorMessage = buildErrorMessage(e, new Object[]{ >> ex.getContentType() >> }); >> >> // FINAL ELSE >> } else { >> errorMessage = buildErrorMessage(e, new Object[]{}); >> } >> >> if (!errors.contains(errorMessage)) { >> errors.add(errorMessage); >> } >> } catch (IOException e) { >> LOG.debug("Unable to parse request", e); >> LocalizedMessage errorMessage = buildErrorMessage(e, new >> Object[]{}); >> if (!errors.contains(errorMessage)) { >> errors.add(errorMessage); >> } >> } >> } >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [email protected] >For additional commands, e-mail: [email protected] >