Bank Of America Preferred Credit Card

Marketing Launch Plan

letra del himno a valencia pdf

:
Story Post Design
[Fix Paras Last Post] Add null check for required 'in' property in ForExecutorBuilder (Pvc Business Cards)
* [Fix May Post Ideas] Add null check for required 'in' property in ForExecutorBuilder ForExecutorBuilder.buildCollectionFilter() dereferences task.getFor().getIn() without a null check. Programmatically-built workflows bypass schema validation, so a ForTask without 'in' set causes a raw NullPointerException with no context. Added Objects.requireNonNull with a descriptive message and a test that verifies the error when 'in' is missing. Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com> * Do a early validation (during workflow build) Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com> --------- Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
1 parent How To Make Blogg commit 307eb07

3 files changed Theme Of A Product Launch Event

Lines changed: 50 additions & 1 deletion

Blog Post Template Copy/Paste Marketing Launch Plan

fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/ForEachTaskBuilder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import io.serverlessworkflow.api.types.TaskItem;
2222
import io.serverlessworkflow.fluent.spec.spi.ForEachTaskFluent;
2323
import java.util.List;
24+
import java.util.Objects;
2425
import java.util.function.Consumer;
2526

2627
public class ForEachTaskBuilder<T extends BaseTaskItemListBuilder<T>>
@@ -85,6 +86,8 @@ public ForEachTaskBuilder<T> tasks(Consumer<T> doBuilderConsumer) {
8586

8687
public ForTask build() {
8788
this.forTask.setFor(this.forTaskConfiguration);
89+
Objects.requireNonNull(
90+
this.forTask.getFor().getIn(), "'in' is a required property for ForTask");
8891
return this.forTask;
8992
}
9093
}

fluent/spec/src/test/java/io/serverlessworkflow/fluent/spec/WorkflowBuilderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void testDoTaskSetAndForEach() {
131131
.tasks(
132132
d ->
133133
d.set("initCtx", "$.foo = 'bar'")
134-
.forEach("item", f -> f.each("item").at("$.list")))
134+
.forEach("item", f -> f.each("item").at("index").in("$.list")))
135135
.build();
136136

137137
List<TaskItem> items = wf.getDo();
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2020-Present The Serverless Workflow Specification Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.serverlessworkflow.impl.test;
17+
18+
import static io.serverlessworkflow.fluent.spec.dsl.DSL.*;
19+
import static org.assertj.core.api.Assertions.assertThatThrownBy;
20+
21+
import io.serverlessworkflow.api.types.Workflow;
22+
import io.serverlessworkflow.fluent.spec.WorkflowBuilder;
23+
import org.junit.jupiter.api.Test;
24+
25+
class ForTaskMissingInTest {
26+
27+
@Test
28+
void forTaskWithoutInShouldFailWithDescriptiveMessage() {
29+
30+
assertThatThrownBy(
31+
() -> {
32+
Workflow ignored =
33+
WorkflowBuilder.workflow("for-missing-in", "test", "0.1.0")
34+
.tasks(
35+
doTasks(
36+
forEach(
37+
"loopWithoutIn",
38+
f ->
39+
f.each("item")
40+
.tasks(t -> t.set("noop", s -> s.put("done", true))))))
41+
.build();
42+
})
43+
.isInstanceOf(NullPointerException.class)
44+
.hasMessageContaining("'in' is a required property for ForTask");
45+
}
46+
}

Post Letter Logo Marketing Launch Plan

Comments
 (0)