| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
convertAsterisk used String.replace with a string argument, which only replaces the first match. In a field like */2,*/3 the second token never got converted to a range and survived as literal text that no time ever matches, so those minutes silently never fired.
validate() never checked the field count and split on raw spaces, so a 7-field expression silently ignored the extra field and irregular spacing misaligned which value each error message blamed. It now reuses the same field-count check and space normalization as validateDetailed(), so the two public APIs agree on the same input.
| Back | FazBrowse Home | New Git URL |
This fixes two bugs found in the pattern validation and conversion code.
Bug 1: validate() and validateDetailed() disagreed on the same input
validate() never checked the number of fields in an expression, so a 7-field
expression like * * * * * * * silently ignored the extra field and returned
true, while validateDetailed() correctly rejected it with "expected 5 or 6
fields but got 7". validate() also split on raw spaces without normalizing
double/leading spaces first, so irregular spacing could misalign which value
an error message blamed.
Fix: validate() now reuses the same field-count check and space
normalization that validateDetailed() already uses, so the two public APIs
agree on the same input.
Bug 2: multiple asterisks in the same field silently never matched
The asterisk-to-range conversion used String.replace('*', replacement),
which only replaces the first match. In a field like */2,*/3, only the
first token got converted to a range; the second token (*/3) survived as
literal text that no time value ever matches, so those minutes silently
never fired.
Fix: the conversion now splits the field on commas and converts every
*/*/n token individually, so all of them expand into working ranges.
Test plan
then implemented the fixes (TDD)