You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Arnon (Created) (JIRA)" <ji...@apache.org> on 2012/01/18 04:39:40 UTC

[jira] [Created] (SCXML-164) In Parallel, it is not work when State transitions to History.

In Parallel, it is not work when State transitions to History.
--------------------------------------------------------------

                 Key: SCXML-164
                 URL: https://issues.apache.org/jira/browse/SCXML-164
             Project: Commons SCXML
          Issue Type: Bug
    Affects Versions: 0.9
         Environment: MAC OS X version 10.6.8
            Reporter: Arnon


The problem was occurred when using Parallel and History together.

2011-12-28 15:08:03,775 INFO : Illegal state machine configuration!
org.apache.commons.scxml.model.ModelException: Illegal state machine
configuration!
    at
org.apache.commons.scxml.semantics.SCXMLSemanticsImpl.followTransitions(SCXMLSemanticsImpl.java:703)
    at
org.apache.commons.scxml.SCXMLExecutor.triggerEvents(SCXMLExecutor.java:127)
    at
org.apache.commons.scxml.env.AbstractStateMachine.fireEvent(AbstractStateMachine.java:201)

This exception was fired when transition from "S1" to "History" by
triggering "Sig1" event (History was already memorized). After the investigation, if we want to transition to History in any States in Parallel, it seems that SCXML requires triggering the same event(that is "Sig1" in this case) for all States in Parallel node(It works fine if we create Transition to self with event "Sig1" on State "S10"), which I think it is not correct.

The equivalent SCXML is following:

<?xml version="1.0" encoding="UTF-8"?>
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="null"
initial="Main">
 <!-- http://commons.apache.org/scxml -->
 <parallel id="Main">
  <state id="region_Region1">
   <initial>
    <transition target="S1">
    </transition>
   </initial>
   <state id="S7">
    <initial>
     <transition target="s4">
     </transition>
    </initial>
    <history id="History" type="shallow">
     <transition>
      <target>       <state id="s4">
        <transition event="Sig3" target="S3">
        </transition>
       </state>
      </target>     </transition>
    </history>
    <transition event="Sig2" target="S1">
    </transition>
    <state id="S3">
    </state>
    <state id="s4">
     <transition event="Sig3" target="S3">
     </transition>
    </state>
   </state>
   <state id="S1">
    <transition event="Sig1" target="History">
    </transition>
    <transition event="Sig0" target="S7">
    </transition>
   </state>
  </state>
  <state id="region_Region2">
   <initial>
    <transition target="S10">
    </transition>
   </initial>
   <state id="S10">
   </state>
  </state>
 </parallel>
</scxml>

>From the source, active states was not valid in Parallel

        if (!SCXMLHelper.isLegalConfig(targetSet, errorReporter)) {
            throw new ModelException("Illegal state machine
configuration!");
        }

in SCXMLHelper.isLegalConfig(targetSet, errorReporter):
        if (tt instanceof Parallel) {
            Parallel p = (Parallel) tt;
            if (count.size() < p.getChildren().size()) {
                errRep.onError(ErrorConstants.ILLEGAL_CONFIG,
                    "Not all AND states active for parallel "
                    + p.getId(), entry);
                legalConfig = false;
            }
        }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira