zhang-arvin opened a new pull request, #18686:
URL: https://github.com/apache/dolphinscheduler/pull/18686

   Fixes #18684
   
   ## What changes
   
   `ShellParameters.checkParameters()` previously used `rawScript != null && 
!rawScript.isEmpty()`, which accepted whitespace-only scripts such as `"   \n\t 
 "`. Such a script passes validation and creates a meaningless task that wastes 
scheduling resources.
   
   This PR trims the script before the emptiness check:
   
   ```java
   return rawScript != null && !rawScript.trim().isEmpty();
   ```
   
   ## Tests
   
   Added unit tests to `ShellParametersTest` covering:
   
   - `null` script → invalid
   - empty script (`""`) → invalid
   - whitespace-only script (`"   \n\t  "`) → invalid
   - valid script (`"echo hello"`) → valid
   - script with surrounding whitespace (`"  \n echo hello \t "`) → valid
   
   All tests in the module pass:
   
   ```
   Tests run: 8, Failures: 0, Errors: 0, Skipped: 0
   ```
   
   ## Files changed
   
   - 
`dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellParameters.java`
   - 
`dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/test/java/org/apache/dolphinscheduler/plugin/task/shell/ShellParametersTest.java`


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