Skip to content

Order of Transition Elements Still Does Not completely adhere to documentation #3996

Closed
@chpasha

Description

@chpasha

Bug description
The original issue was fixed here #3638 but the the way the DefaultStateTransitionComparator works is stll different from what documentation says:
it states that

The framework automatically orders transitions from most specific to least specific

but the javadoc in comparator says

If wildcard counts are equal then falls back to alphabetic comparison. Hence * > foo* > ??? > fo? > foo.

this looks wrong to me since foo* is more specific pattern then * so it should fire before. Consider situation where Step execution can return COMPLETED or COMPLETED_PARTIALLY (alongside other possible statuses) and those two completed states should lead to different flow then FAILED (or any other) but conditional flow

.start(mainWorkflowStep).on("COMPLETED*").to(step1)
.from(mainWorkflowStep).on("*").to(step2)

doesn't work as expected because * fires and leads to step2 even on exit statuses like COMPLETED or COMPLETED_PARTIALLY
Current workaround is to use ** instead of single * so that COMPLETED* is considered "more important"

Environment
Spring Batch version : 4.3.3,
Java version 11

Expected behavior
standalone * should be never first but always the last in the pipeline since it is a catchall pattern and any other pattern containing characters other than * is "more specific"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions