Skip to content

NIFI-15601 Improved the TIME_DURATION_REGEX in DurationFormat.java to accurately capture a positive decimal number with or without a leading integer.#66

Merged
exceptionfactory merged 1 commit intoapache:mainfrom
dan-s1:NIFI-15601
Mar 5, 2026

Conversation

@dan-s1
Copy link
Contributor

@dan-s1 dan-s1 commented Feb 13, 2026

Summary

NIFI-15601
In order to standardize the exceptions thrown, I improved the TIME_DURATION_REGEX regular expression in DurationFormat to capture a positive decimal number whether it has a leading integer or not and not allow for more than one period.
In addition to adding unit tests to test when the duration value has illegal characters, I also added another case to an existing parameterized test testGetPreciseTimeDurationWithDecimalNumbers to test a decimal that does not even have a leading zero.

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

… accurately capture a positive decimal number with or without a leading integer.
Copy link
Contributor

@exceptionfactory exceptionfactory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dan-s1, I concur with the more precise regular expression pattern, the changes look good and the additional tests are helpful. +1 merging

@markap14
Copy link
Contributor

markap14 commented Mar 5, 2026

Thanks for fixing @dan-s1 changes make sense. Code looks good, tests are good. +1 will merge

@markap14
Copy link
Contributor

markap14 commented Mar 5, 2026

Ha! @exceptionfactory beat me to it! Will stand down :)

@exceptionfactory exceptionfactory merged commit 012cbf5 into apache:main Mar 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants