Adalennis opened a new issue, #9049:
URL: https://github.com/apache/hop/issues/9049

   ### Apache Hop version?
   
   2.20.0-SNAPSHOT
   
   ### Java version?
   
   Java 21
   
   ### Operating system
   
   macOS
   
   ### What happened?
   
   Found while documenting the result of these actions (#8970, third batch). 
All cases reproduced with hop-run on the current main and in Hop Gui 2.19.
   
   **1. Add filenames to result: a result row with one field stops the 
workflow**
   
   With *Copy previous results to args?* and result rows that have only one 
field (the path), the action throws a NullPointerException that escapes 
`execute()`: the workflow stops with "Unexpected error occurred while launching 
entry", and no hop is followed.
   `ActionAddResultFilenames.execute` reads `resultRow.getString(1, null)` for 
the wildcard without checking the number of fields. Unzip, which also reads two 
fields, catches the same error and counts it as one error.
   
   **2. Unzip counts some errors twice**
   
   - A file that is not a valid zip counts as two errors: `unzipFile` calls 
`updateErrors()` in its catch and returns false, and `processOneFile` calls 
`updateErrors()` again.
   - The same happens when *After extraction* is *Delete files* and the zip 
file can't be deleted.
   
   With *Nr errors less than* this makes the limit reached twice as fast.
   
   **3. Unzip: *If file exists* = *Fail* also fails for entries that are not 
extracted**
   
   `takeThisFile()` is called before the include/exclude wildcard check, so an 
entry left out by *Include Wildcard (RegExp)* or *Exclude Wildcard (RegExp)* 
still counts as an error when a file with its name exists in the target folder. 
The log says "was skipped and errors was updated. We have now 1 errors" and 
"Total errors : 1", but the action ends with 2 errors (see point 2).
   
   **4. Delete file is true with 1 error when the file can't be deleted**
   
   When `fileObject.delete()` returns false (for example a folder that is not 
empty), the action logs "Could not delete file", then "File [...] deleted!", 
sets the number of errors to 1, and still sets the result to true, so the 
success hop is followed.
   
   **5. Create folder is true when a file exists with the folder name**
   
   When the path exists as a file and *Fail if folder exists* is not selected, 
the action is true and no folder is created. It logs "File [...] exists" only 
when *Fail if folder exists* is selected.
   
   **6. Delete filenames from result keeps result files that no longer exist on 
disk**
   
   With *Limit action to*, a result file is only removed when `file.exists()`. 
A file that was deleted earlier in the workflow stays in the result files, even 
when its name matches the wildcard.
   
   The current behaviour is documented in a NOTE on each action page (PR 
#9047), so the docs need an update when these are fixed.
   
   
   ### Issue Priority
   
   Priority: 3
   
   ### Issue Component
   
   Component: Hop Gui


-- 
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]

Reply via email to