fix(wait-task): accept ISO-8601 duration and fix misleading error message - #1474
Open
shaileshpadave wants to merge 3 commits into
Open
fix(wait-task): accept ISO-8601 duration and fix misleading error message#1474shaileshpadave wants to merge 3 commits into
shaileshpadave wants to merge 3 commits into
Conversation
…nvalid format parseDuration() only accepted the custom "1s"/"2m"/"1h 30m" format. Using ISO-8601 (e.g. "PT1S") threw an IllegalArgumentException that got caught and re-thrown with the misleading "Either date or duration is passed as null" message. Now parseDuration() tries the custom format first, then falls back to Duration.parse() for ISO-8601. If both fail, the constraint surfaces the actual error message from parseDuration() instead of the null-blame message. Fixes #1310
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A WAIT task with
"duration": "PT1S"(ISO-8601) failed with "Either date or duration is passed as null" — a message that implies the field was absent, when it was actually present but in an unsupported format.Two changes:
DateTimeUtils.parseDuration()— after the custom format ("1s","2m") fails to match, fall back tojava.time.Duration.parse()so ISO-8601 durations like"PT1S","P5D","PT1H30M"work natively.WorkflowTaskTypeConstraint— whenparseDuration()still throws (genuinely invalid input), surface the actual error message instead of the misleading "passed as null" message.Fixes #1310
How to verify
{ "type": "WAIT", "name": "wait1", "taskReferenceName": "wait_ref", "inputParameters": { "duration": "PT1S" } }"duration": "PT"— the error now reads "Not valid duration: PT" instead of blaming null.