thswlsqls opened a new pull request, #39364:
URL: https://github.com/apache/shardingsphere/pull/39364

   Fixes #39362.
   
   Changes proposed in this pull request:
     - `MASK_FROM_X_TO_Y` and `KEEP_FROM_X_TO_Y` reject `from-x: 0` / `to-y: 0` 
with `AlgorithmInitializationException`, although `mask.en.md` and `mask.cn.md` 
both document them as `start position (from 0)` / `end position (from 0)`.
     - The runtime is already 0-based: `MaskFromXToYMaskAlgorithm.mask()` uses 
`fromX` directly as a char array index, so position 0 works once initialization 
accepts it.
     - Add `MaskAlgorithmPropertiesChecker.checkNonNegativeInteger()` and 
switch the four position-typed call sites (`from-x`, `to-y` in both algorithms) 
to it.
     - Keep `checkPositiveInteger()` unchanged: `first-n` / `last-m` in 
`KeepFirstNLastMMaskAlgorithm` and `MaskFirstNLastMMaskAlgorithm` are counts, 
not positions, so `> 0` stays correct for them.
     - Negative values are still rejected; the existing `negative_from_X` / 
`negative_to_Y` init cases still pass.
     - Add checker unit tests for zero, positive, negative, missing key and 
non-integer input, plus `from-x=0` execute cases to both algorithm tests.
     - No documentation change: the docs already describe the intended 
contract, the code did not honour it.
     - Verified with `./mvnw install -pl features/mask/core -am` plus 
repository-wide spotless, checkstyle and apache-rat: 159 tests pass.
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following 
options:
   - [x] My code follows the [code of 
conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) 
of this project.
   - [x] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the 
pull request.
   - [ ] I have passed maven check locally : `./mvnw clean install -B -T1C 
-Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
   - [ ] I have made corresponding changes to the documentation.
   - [x] I have added corresponding unit tests for my changes.
   - [x] I have updated the Release Notes of the current development version. 
For more details, see [Update Release 
Note](https://shardingsphere.apache.org/community/en/involved/contribute/contributor/)
   


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