com.alibaba.cola.statemachine.impl.StateMachineImpl#routeTransitions、routeTransition 执行有npe · Issue #583 · alibaba/COLA · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
StateMachineImpl#routeTransitions和StateMachineImpl#routeTransition both have npe
solution :
private Transition<S, E, C> routeTransition(S sourceStateId, E event) {
State sourceState = getState(sourceStateId);
List<Transition<S, E, C>> transitions = sourceState.getEventTransitions(event);
if (transitions == null || transitions.size() == 0) {
return null;
}
return transitions.get(0);
}
.......
private List<Transition<S, E, C>> routeTransitions(S sourceStateId, E event) {
State sourceState = getState(sourceStateId);
List<Transition<S, E, C>> transitions = sourceState.getEventTransitions(event);
return transitions;
}
.......... @OverRide
public S fireEvent(S sourceStateId, E event, C ctx) {
isReady();
Transition<S, E, C> transition = routeTransition(sourceStateId, event);
if (transition == null) {
Debugger.debug("There is no Transition for " + event);
failCallback.onFail(sourceStateId, event, ctx);
return sourceStateId;
}
return transition.transit(ctx).getId();
}
.....
@OverRide
public List fireParallelEvent(S sourceState, E event, C context) {
isReady();
List<Transition<S, E, C>> transitions = routeTransitions(sourceState, event);
List result = new ArrayList<>();
if (transitions == null || transitions.isEmpty()) {
Debugger.debug("There is no Transition for " + event);
failCallback.onFail(sourceState, event, context);
result.add(sourceState);
return result;
}
for (Transition<S, E, C> transition : transitions) {
S id = transition.transit(context).getId();
result.add(id);
}
return result;
}
....
State<S, E, C> transit(C ctx);
..... @OverRide
public State<S, E, C> transit(C ctx) {
Debugger.debug("Do transition: " + this);
this.verify();
if (condition == null || condition.isSatisfied(ctx)) {
if (action != null) {
action.execute(source.getId(), target.getId(), event, ctx);
}
return target;
}
Debugger.debug("Condition is not satisfied, stay at the " + source + " state ");
return source;
}
The text was updated successfully, but these errors were encountered:
StateMachineImpl#routeTransitions和StateMachineImpl#routeTransition both have npe
solution :
private Transition<S, E, C> routeTransition(S sourceStateId, E event) {
State sourceState = getState(sourceStateId);
List<Transition<S, E, C>> transitions = sourceState.getEventTransitions(event);
if (transitions == null || transitions.size() == 0) {
return null;
}
return transitions.get(0);
}
.......
private List<Transition<S, E, C>> routeTransitions(S sourceStateId, E event) {
State sourceState = getState(sourceStateId);
List<Transition<S, E, C>> transitions = sourceState.getEventTransitions(event);
return transitions;
}
..........
@OverRide
public S fireEvent(S sourceStateId, E event, C ctx) {
isReady();
Transition<S, E, C> transition = routeTransition(sourceStateId, event);
if (transition == null) {
Debugger.debug("There is no Transition for " + event);
failCallback.onFail(sourceStateId, event, ctx);
return sourceStateId;
}
return transition.transit(ctx).getId();
}
.....
@OverRide
public List fireParallelEvent(S sourceState, E event, C context) {
isReady();
List<Transition<S, E, C>> transitions = routeTransitions(sourceState, event);
List result = new ArrayList<>();
if (transitions == null || transitions.isEmpty()) {
Debugger.debug("There is no Transition for " + event);
failCallback.onFail(sourceState, event, context);
result.add(sourceState);
return result;
}
for (Transition<S, E, C> transition : transitions) {
S id = transition.transit(context).getId();
result.add(id);
}
return result;
}
....
State<S, E, C> transit(C ctx);
.....
@OverRide
public State<S, E, C> transit(C ctx) {
Debugger.debug("Do transition: " + this);
this.verify();
if (condition == null || condition.isSatisfied(ctx)) {
if (action != null) {
action.execute(source.getId(), target.getId(), event, ctx);
}
return target;
}
The text was updated successfully, but these errors were encountered: