From 0c500794f6ef94d74196facd401d96210cd3a6f8 Mon Sep 17 00:00:00 2001 From: Artyom Gabeev Date: Wed, 28 Nov 2018 18:38:53 +0300 Subject: [PATCH] Do not call getName on step/flow - they may be Job/Step scoped proxies Resolves #857 --- .../batch/core/job/builder/FlowBuilder.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowBuilder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowBuilder.java index d06c69c05..04cec5d67 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowBuilder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/builder/FlowBuilder.java @@ -70,6 +70,10 @@ public class FlowBuilder { private EndState stoppedState; + private int stepCounter = 0; + + private int flowCounter = 0; + private int decisionCounter = 0; private int splitCounter = 0; @@ -282,7 +286,7 @@ public class FlowBuilder { if (input instanceof Step) { if (!states.containsKey(input)) { Step step = (Step) input; - states.put(input, new StepState(prefix + step.getName(), step)); + states.put(input, new StepState(prefix + "step" + (stepCounter++), step)); } result = states.get(input); } @@ -295,7 +299,7 @@ public class FlowBuilder { } else if (input instanceof Flow) { if (!states.containsKey(input)) { - states.put(input, new FlowState((Flow) input, prefix + ((Flow) input).getName())); + states.put(input, new FlowState((Flow) input, prefix + "flow" + (flowCounter++))); } result = states.get(input); }