[ 
https://issues.apache.org/jira/browse/WW-5546?focusedWorklogId=968539&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-968539
 ]

ASF GitHub Bot logged work on WW-5546:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/May/25 16:22
            Start Date: 05/May/25 16:22
    Worklog Time Spent: 10m 
      Work Description: sonarqubecloud[bot] commented on PR #1262:
URL: https://github.com/apache/struts/pull/1262#issuecomment-2851537613

   ## [![Quality Gate 
Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png
 'Quality Gate 
Passed')](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=1262) 
**Quality Gate passed**  
   Issues  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0 New 
issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1262&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png
 '') [0 Accepted 
issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1262&issueStatuses=ACCEPTED)
   
   Measures  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=1262&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [100.0% Coverage on New 
Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1262&metric=new_coverage&view=list)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0.0% Duplication on New 
Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1262&metric=new_duplicated_lines_density&view=list)
  
     
   [See analysis details on SonarQube 
Cloud](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=1262)
   
   




Issue Time Tracking
-------------------

    Worklog Id:     (was: 968539)
    Time Spent: 20m  (was: 10m)

> NPE in AbstractFileUploadInterceptor
> ------------------------------------
>
>                 Key: WW-5546
>                 URL: https://issues.apache.org/jira/browse/WW-5546
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core, Core Interceptors
>    Affects Versions: 6.7.4
>            Reporter: Barta Tamás
>            Assignee: Lukasz Lenart
>            Priority: Major
>             Fix For: 6.8.0, 7.1.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> I got the following exception:
>  
> {code:java}
> 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)
>  {code}
> I think the bug is in AbstractFileUploadInterceptor:
>  
>  
> {code:java}
> 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()) { {code}
> 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.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to