burtonrhodes commented on PR #861:
URL: https://github.com/apache/struts/pull/861#issuecomment-1915569409
Just FYI, I implemented this PR on a small subset of my server cluster and
have been receiving the following ambiguous errors in some of the upload
requests. I can't duplicate it in any testing environment, but curious if you
might have a clue as to why Struts is creating an actionError with no value for
the file. For this implementation, I am **_not_** using the stream parser
_Error printed by the code below_
```
Unidentified ActionError present for file upload: [Error uploading: {0}!,
Error uploading: {0}!]
```
_Code that quickly checks for any file upload errors_
```
if (hasActionErrors()) {
List<String> uploadErrors = (List<String>) getActionErrors();
log.error("Unidentified ActionError present for file upload: " +
uploadErrors);
}
```
_A redacted version of the action_
```
public class UploadLocalFileJsonAction extends ActionSupport implements
Validateable, UploadedFilesAware<UploadedFile<File>> {
private FileAttachmentUpload fileAttachmentUpload;
@Override
public void withUploadedFiles(List<UploadedFile<UploadedFile<File>>>
uploadedFiles) {
if (!uploadedFiles.isEmpty()) {
fileAttachmentUpload =
UploadedFileHelper.createFromUploadedFile(uploadedFiles.get(0));
}
}
public void validate() {
// First check to see if there are any errors from the file upload
if (hasActionErrors()) {
List<String> uploadErrors = (List<String>) getActionErrors();
log.error("Unidentified ActionError present for file upload: " +
uploadErrors);
}
}
public String execute() throws Exception {
// Omitted for brevity
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]