|
1 | 1 | /* |
2 | | - * Copyright (c) 2013 Red Hat, Inc. and/or its affiliates. |
| 2 | + * Copyright (c) 2013-2018 Red Hat, Inc. and/or its affiliates. |
3 | 3 | * |
4 | 4 | * This program and the accompanying materials are made |
5 | 5 | * available under the terms of the Eclipse Public License 2.0 |
@@ -48,33 +48,41 @@ protected void runFromHeadOrRestartPoint(final String restartPoint) { |
48 | 48 | //clear the restart point passed over from original job execution. This execution may have its own |
49 | 49 | //restart point or null (start from head) for use by the next restart. |
50 | 50 | jobContext.getJobExecution().setRestartPosition(null); |
| 51 | + boolean restartPointFound = false; |
51 | 52 | for (final JobElement e : getJobElements()) { |
52 | 53 | if (e instanceof Step) { |
53 | 54 | final Step step = (Step) e; |
54 | 55 | if (step.getId().equals(restartPoint)) { |
| 56 | + restartPointFound = true; |
55 | 57 | runStep(step); |
56 | 58 | break; |
57 | 59 | } |
58 | 60 | } else if (e instanceof Flow) { |
59 | 61 | final Flow flow = (Flow) e; |
60 | 62 | if (flow.getId().equals(restartPoint)) { |
| 63 | + restartPointFound = true; |
61 | 64 | runFlow(flow, null); |
62 | 65 | break; |
63 | 66 | } |
64 | 67 | } else if (e instanceof Split) { |
65 | 68 | final Split split = (Split) e; |
66 | 69 | if (split.getId().equals(restartPoint)) { |
| 70 | + restartPointFound = true; |
67 | 71 | runSplit(split); |
68 | 72 | break; |
69 | 73 | } |
70 | 74 | } else if (e instanceof Decision) { |
71 | 75 | final Decision decision = (Decision) e; |
72 | 76 | if (decision.getId().equals(restartPoint)) { |
| 77 | + restartPointFound = true; |
73 | 78 | runDecision(decision); |
74 | 79 | break; |
75 | 80 | } |
76 | 81 | } |
77 | 82 | } |
| 83 | + if (!restartPointFound) { |
| 84 | + throw BatchMessages.MESSAGES.couldNotFindRestartPoint(restartPoint, jobContext.getJobName()); |
| 85 | + } |
78 | 86 | } else { |
79 | 87 | // the head of the composite job element is the first non-abstract element (step, flow, or split) |
80 | 88 | for (final JobElement e : getJobElements()) { |
|
0 commit comments