You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ute Kaiser <ut...@web.de.INVALID> on 2025/10/01 16:02:47 UTC
No fielderror for empty files with ActionFileUploadInterceptor
Hi,
I would appreaciate a field error when I try to upload an empty file.
I only find a server log warning
WARN [org.apache.struts2.interceptor.ActionFileUploadInterceptor] (default task-2) Es konnte kein Dateiname für uploadDe ermittelt werden. Überprüfen Sie ob eine gültige Datei übermittelt wurde.
(German properties-Key struts.messages.invalid.file=Could not find a Filename for {0}. Verify that a valid file was submitted.)
ActionFileUploadInterceptor.intercept runs into the if, so all nice errors from acceptFile are not reachable.
if (uploadedFiles == null || uploadedFiles.length == 0) {
if (LOG.isWarnEnabled()) {
LOG.warn(getTextMessage(action, STRUTS_MESSAGES_INVALID_FILE_KEY, new String[]{inputName}));
}
} else {
for (UploadedFile uploadedFile : uploadedFiles) {
if (acceptFile(action, uploadedFile, uploadedFile.getOriginalName(), uploadedFile.getContentType(), inputName)) {
acceptedFiles.add(uploadedFile);
}
}
}
It seems impossible to write a field error on my own.
(I have 3 upload options, so I can not raise an error if one of them is null.)
Best regards
Ute
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Re: No fielderror for empty files with ActionFileUploadInterceptor
Posted by Lukasz Lenart <lu...@apache.org>.
śr., 1 paź 2025 o 20:07 Ute Kaiser <ut...@web.de.invalid> napisał(a):
>
> Hi Lukasz,
> fine and thx !!!
> But I am afraid I have to wait not familiar with github and no maven (migrating from 2002 means ant :-)
You can download all the libs from here
https://dist.apache.org/repos/dist/dev/struts/7.1.1/
Cheers
Łukasz
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Aw: Re: No fielderror for empty files with ActionFileUploadInterceptor
Posted by Ute Kaiser <ut...@web.de.INVALID>.
Hi Lukasz,
fine and thx !!!
But I am afraid I have to wait not familiar with github and no maven (migrating from 2002 means ant :-)
Best regards
Ute
> Gesendet: Mittwoch, 1. Oktober 2025 um 18:14
> Von: "Lukasz Lenart" <lu...@apache.org>
> An: "Struts Users Mailing List" <us...@struts.apache.org>
> Betreff: Re: No fielderror for empty files with ActionFileUploadInterceptor
>
> Please check the latest 6.8.0 (under vote) or 7.1.1 (test build is
> ready) versions as this behaviour has changed
> https://issues.apache.org/jira/browse/WW-5366
>
> śr., 1 paź 2025 o 18:12 Ute Kaiser <ut...@web.de.invalid> napisał(a):
> >
> > Hi,
> >
> > I would appreaciate a field error when I try to upload an empty file.
> >
> > I only find a server log warning
> > WARN [org.apache.struts2.interceptor.ActionFileUploadInterceptor] (default task-2) Es konnte kein Dateiname für uploadDe ermittelt werden. Überprüfen Sie ob eine gültige Datei übermittelt wurde.
> > (German properties-Key struts.messages.invalid.file=Could not find a Filename for {0}. Verify that a valid file was submitted.)
> >
> > ActionFileUploadInterceptor.intercept runs into the if, so all nice errors from acceptFile are not reachable.
> > if (uploadedFiles == null || uploadedFiles.length == 0) {
> > if (LOG.isWarnEnabled()) {
> > LOG.warn(getTextMessage(action, STRUTS_MESSAGES_INVALID_FILE_KEY, new String[]{inputName}));
> > }
> > } else {
> > for (UploadedFile uploadedFile : uploadedFiles) {
> > if (acceptFile(action, uploadedFile, uploadedFile.getOriginalName(), uploadedFile.getContentType(), inputName)) {
> > acceptedFiles.add(uploadedFile);
> > }
> > }
> > }
> >
> > It seems impossible to write a field error on my own.
> > (I have 3 upload options, so I can not raise an error if one of them is null.)
> >
> > Best regards
> > Ute
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: No fielderror for empty files with ActionFileUploadInterceptor
Posted by Lukasz Lenart <lu...@apache.org>.
Please check the latest 6.8.0 (under vote) or 7.1.1 (test build is
ready) versions as this behaviour has changed
https://issues.apache.org/jira/browse/WW-5366
śr., 1 paź 2025 o 18:12 Ute Kaiser <ut...@web.de.invalid> napisał(a):
>
> Hi,
>
> I would appreaciate a field error when I try to upload an empty file.
>
> I only find a server log warning
> WARN [org.apache.struts2.interceptor.ActionFileUploadInterceptor] (default task-2) Es konnte kein Dateiname für uploadDe ermittelt werden. Überprüfen Sie ob eine gültige Datei übermittelt wurde.
> (German properties-Key struts.messages.invalid.file=Could not find a Filename for {0}. Verify that a valid file was submitted.)
>
> ActionFileUploadInterceptor.intercept runs into the if, so all nice errors from acceptFile are not reachable.
> if (uploadedFiles == null || uploadedFiles.length == 0) {
> if (LOG.isWarnEnabled()) {
> LOG.warn(getTextMessage(action, STRUTS_MESSAGES_INVALID_FILE_KEY, new String[]{inputName}));
> }
> } else {
> for (UploadedFile uploadedFile : uploadedFiles) {
> if (acceptFile(action, uploadedFile, uploadedFile.getOriginalName(), uploadedFile.getContentType(), inputName)) {
> acceptedFiles.add(uploadedFile);
> }
> }
> }
>
> It seems impossible to write a field error on my own.
> (I have 3 upload options, so I can not raise an error if one of them is null.)
>
> Best regards
> Ute
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org