From 0a6992959a28e7951099fe43bb17e58b0311fab9 Mon Sep 17 00:00:00 2001 From: Janne Valkealahti Date: Mon, 1 Jul 2019 09:07:13 +0100 Subject: [PATCH] Fix NPR in ReactiveStateMachineExecutor - Re-enable test in EventDeferTests as this NPE fix now handles smoke test. - Relates #791 --- .../statemachine/support/ReactiveStateMachineExecutor.java | 5 ++++- .../org/springframework/statemachine/EventDeferTests.java | 5 +---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spring-statemachine-core/src/main/java/org/springframework/statemachine/support/ReactiveStateMachineExecutor.java b/spring-statemachine-core/src/main/java/org/springframework/statemachine/support/ReactiveStateMachineExecutor.java index 5b579809..575e62fb 100644 --- a/spring-statemachine-core/src/main/java/org/springframework/statemachine/support/ReactiveStateMachineExecutor.java +++ b/spring-statemachine-core/src/main/java/org/springframework/statemachine/support/ReactiveStateMachineExecutor.java @@ -269,7 +269,10 @@ public class ReactiveStateMachineExecutor extends LifecycleObjectSupport i // most likely timer if (trans.isEmpty()) { - trans.add(triggerToTransitionMap.get(queueItem.trigger)); + Transition t = triggerToTransitionMap.get(queueItem.trigger); + if (t != null) { + trans.add(t); + } } // go through candidates and transit max one, sort before handling diff --git a/spring-statemachine-core/src/test/java/org/springframework/statemachine/EventDeferTests.java b/spring-statemachine-core/src/test/java/org/springframework/statemachine/EventDeferTests.java index 32722999..cfd7ec33 100644 --- a/spring-statemachine-core/src/test/java/org/springframework/statemachine/EventDeferTests.java +++ b/spring-statemachine-core/src/test/java/org/springframework/statemachine/EventDeferTests.java @@ -91,10 +91,7 @@ public class EventDeferTests extends AbstractStateMachineTests { assertThat(readField.size(), is(3)); } - // @Test - // TODO: REACTOR disable for now to figure out what a hell! - // java.lang.NullPointerException: The iterator returned a null value - // from reactor and every attempt to figure it out failed + @Test public void testDeferSmokeExecutorConcurrentModification() throws Exception { context.register(Config5.class); context.refresh();