[ 
https://issues.apache.org/jira/browse/NIFI-15316?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kim Seung Ho updated NIFI-15316:
--------------------------------
      Component/s: Core Framework
    Fix Version/s: 2.6.0
      Description: 
In GetFile.java, the isEmpty() check at line 423-425 is dead code.

The variable `relativePathString` is assigned with `relativePath.toString() + 
"/"` 
which always contains at least "/" character, making the isEmpty() condition 
always false.

The original intent was likely to check if relativePath is empty (when file is 
directly under the input directory), but the "/" is appended before the check.

Fix: Check isEmpty() on relativePath.toString() before appending "/".

> [GetFile] Dead code in onTrigger - isEmpty() check unreachable after string 
> concatenation
> -----------------------------------------------------------------------------------------
>
>                 Key: NIFI-15316
>                 URL: https://issues.apache.org/jira/browse/NIFI-15316
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 2.6.0
>            Reporter: Kim Seung Ho
>            Priority: Trivial
>             Fix For: 2.6.0
>
>
> In GetFile.java, the isEmpty() check at line 423-425 is dead code.
> The variable `relativePathString` is assigned with `relativePath.toString() + 
> "/"` 
> which always contains at least "/" character, making the isEmpty() condition 
> always false.
> The original intent was likely to check if relativePath is empty (when file 
> is 
> directly under the input directory), but the "/" is appended before the check.
> Fix: Check isEmpty() on relativePath.toString() before appending "/".



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

Reply via email to