if (newState.isSameOrSubState(ClosedState.COMPLETED)) {
complete ();
return;
}
} catch (CannotCompleteException e) {
throw new TransitionNotAllowedException
(e.getClass().getName() + ": " + e.getMessage());
}
if (typedState().isSameOrSubState(SuspendedState.ABANDONING)
&& newState.isSameOrSubState(SuspendedState.CLEARING_EXCEPTION)) {
updateImmediate(SuspendedState.SUSPENDED);
return;
}
if (getPaDebug ()) {
State oldState = typedState ();
if (newState == DebugState.FORWARDING_EXCEPTION
&& STATE_TO_SUB_STATE.containsKey(oldState)) {
setPaSubStateBackup
(((Integer)STATE_TO_SUB_STATE.get(oldState)).intValue());
setPaTypedState (newState);
return;
}
if (newState == DebugState.AWAITING_EXCEPTION) {
if (oldState == DebugState.ABANDONING) {
// Proceed from abandoning
setPaTypedState (newState);
return;
}
throw new TransitionNotAllowedException
("Change to " + DebugState.AWAITING_EXCEPTION
+ " is only allowed from " + DebugState.ABANDONING);
}
if (oldState.isSameOrSubState (RunningState.DEBUG)) {
if (!newState.isSameOrSubState (OpenState.RUNNING)
&& !(oldState == DebugState.INVOKING
&& newState.isSameOrSubState
(NotRunningState.SUSPENDED))) {
throw new TransitionNotAllowedException
("Only valid change from debug states is to "
+ OpenState.RUNNING + " or sub-state");
}
// Resume closing with the proper state.