Hi! I'm afraid I can't and the action class itself is not relevant here, because it isn't called yet. Before the ERROR log (the stacktrace) there is only one log line with empty message:
2025-04-29 10:08:21,810 WARN [org.apache.struts2.interceptor.AbstractFileUploadInterceptor] (default task-13179/Yngvbmgw08HwnX2JfPmo9KJy8gPw1-JJxe9bMmoh) I think I found the bug in AbstractFileUploadInterceptor, the related lines: if (file.getContent() == null) { String errMsg = getTextMessage(action, STRUTS_MESSAGES_ERROR_UPLOADING_KEY, new String[]{originalFilename}); errorMessages.add(errMsg); LOG.warn(errMsg); } if (maximumSize != null && maximumSize < file.length()) { If file.getContent() is null (which means StrutsUploadedFile.file is null), then warning is logged but there is no "return false" so execution continues and file.length() will throw NPE as file is null in StrutsUploadedFile. Lukas, could you please fix this bug? Regards, Tamás On Tue, Apr 29, 2025 at 2:19 PM M Huzaifah <mhuzaifah.i...@gmail.com> wrote: > Hii Tamás, > > Could you please attach your action class, so all of us in here can > see the details. > > Thank you > > On Tue, Apr 29, 2025 at 7:00 PM Tamás Barta <bartata...@gmail.com> wrote: > > > > Hi! > > > > We use Struts 6.7.4 and today we got the following exception in our > > production system. I don't know how it is possible or how to reproduce it > > or how to avoid it. Do you have any ideas? Of course it was a POST with > > file upload. > > > > java.lang.NullPointerException: Cannot invoke "java.io.File.length()" > > because "this.file" is null > > at > > > deployment.deployment.ear//org.apache.struts2.dispatcher.multipart.StrutsUploadedFile.length(StrutsUploadedFile.java:52) > > at > > > deployment.deployment.ear//org.apache.struts2.interceptor.AbstractFileUploadInterceptor.acceptFile(AbstractFileUploadInterceptor.java:133) > > at > > > deployment.deployment.ear//org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:232) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.interceptor.AbstractInterceptor.intercept(AbstractInterceptor.java:36) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:303) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:257) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:104) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.interceptor.AbstractInterceptor.intercept(AbstractInterceptor.java:36) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:303) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:257) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:169) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.interceptor.AbstractInterceptor.intercept(AbstractInterceptor.java:36) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:303) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:257) > > at > > > deployment.deployment.ear//org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:154) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.interceptor.AbstractInterceptor.intercept(AbstractInterceptor.java:36) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:303) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:257) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:199) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.interceptor.AbstractInterceptor.intercept(AbstractInterceptor.java:36) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:303) > > at > > > deployment.deployment.ear//com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:257) > > ... > > > > Thanks, Tamás > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >