Skip to content

Commit 0c50079

Browse files
ArtyomGabeevfmbenhassine
authored andcommitted
Do not call getName on step/flow - they may be Job/Step scoped proxies
Resolves #857
1 parent fae6c5b commit 0c50079

File tree

1 file changed

+6
-2
lines changed
  • spring-batch-core/src/main/java/org/springframework/batch/core/job/builder

1 file changed

+6
-2
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowBuilder.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ public class FlowBuilder<Q> {
7070

7171
private EndState stoppedState;
7272

73+
private int stepCounter = 0;
74+
75+
private int flowCounter = 0;
76+
7377
private int decisionCounter = 0;
7478

7579
private int splitCounter = 0;
@@ -282,7 +286,7 @@ private State createState(Object input) {
282286
if (input instanceof Step) {
283287
if (!states.containsKey(input)) {
284288
Step step = (Step) input;
285-
states.put(input, new StepState(prefix + step.getName(), step));
289+
states.put(input, new StepState(prefix + "step" + (stepCounter++), step));
286290
}
287291
result = states.get(input);
288292
}
@@ -295,7 +299,7 @@ else if (input instanceof JobExecutionDecider) {
295299
}
296300
else if (input instanceof Flow) {
297301
if (!states.containsKey(input)) {
298-
states.put(input, new FlowState((Flow) input, prefix + ((Flow) input).getName()));
302+
states.put(input, new FlowState((Flow) input, prefix + "flow" + (flowCounter++)));
299303
}
300304
result = states.get(input);
301305
}

0 commit comments

Comments
 (0)