You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Rahul Akolkar (JIRA)" <ji...@apache.org> on 2008/04/26 03:57:57 UTC

[jira] Commented: (SCXML-67) can't have

    [ https://issues.apache.org/jira/browse/SCXML-67?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592545#action_12592545 ] 

Rahul Akolkar commented on SCXML-67:
------------------------------------

I intend to close this issue as fixed in a week's time. Please post your comments if you're able to test by then.


> <state> can't have <parallel> 
> ------------------------------
>
>                 Key: SCXML-67
>                 URL: https://issues.apache.org/jira/browse/SCXML-67
>             Project: Commons SCXML
>          Issue Type: Bug
>    Affects Versions: 0.7
>            Reporter: SeongSoo Park
>             Fix For: 0.8
>
>
> According to the latest SCXML W/D the <state> can have <parallel> as its child.
> But, Commons SCXML 0.7 doesn't  seems to support that. 
> The  org.apache.commons.scxml.io.SCXMLParser can't parse this scxml doc. 
> <?xml version="1.0"?>
> <scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"
>   initialstate="microwave"> 
>   <state id="microwave">
>    <initial>
>           <transition  target="parts"/>	 
>     </initial>
>     <parallel id="parts">
>       <state id="oven">
>           <initial>
>                <transition  target="oven2"/>	 
>           </initial>
>              <state id= "oven2">
>                <transition event="exit"  target="dest"/>
>              </state>
>       </state>
>       <state id="door">
>              <initial>
>                    <transition  target="door2"/>	 
>              </initial>
>               <state id= "door2">
> 	 <transition event="e" target="dest"/>
>              </state>
>       </state>
>     </parallel>
>   </state>
>   <state id= "dest"  final ="true"/>
> </scxml>
> The SCXML  engine generates the following exception during parsing the scxml doc.
> Exception in thread "main" java.lang.ClassCastException: org.apache.commons.scxml.model.Parallel
> 	at org.apache.commons.scxml.io.ModelUpdater.updateState(ModelUpdater.java:213)
> 	at org.apache.commons.scxml.io.ModelUpdater.updateSCXML(ModelUpdater.java:78)
> 	at org.apache.commons.scxml.io.SCXMLParser.parse(SCXMLParser.java:268)
> 	at org.apache.commons.scxml.io.SCXMLParser.parse(SCXMLParser.java:152)
> 	at org.apache.commons.scxml.test.StandaloneUtils.execute(StandaloneUtils.java:80)
> 	at org.apache.commons.scxml.test.StandaloneJexlExpressions.main(StandaloneJexlExpressions.java:60)
> So, I fixed  the 'updateState()' in org.apache.commons.scxml.io.ModelUpdater class like this 
> (and also org.apache.commons.scxml.io.SCXMLSerializer.serializeState() )
>         ..........
>         } else {
>             Iterator j = c.keySet().iterator();
>             /* ---- your code  ----
>             while (j.hasNext()) {
>                 updateState((State) c.get(j.next()), targets);
>             }
>              */
>             /* -------   my fixed code ---------*/
>             while (j.hasNext()) {
>                TransitionTarget tt = (TransitionTarget) c.get(j.next());
>                 if (tt instanceof State) {
>                    updateState((State) tt, targets);
>                 } else {
>                    updateParallel((Parallel) tt, targets);
>                }
>            }
>           /*  ------------------------------------*/
>         }
>     } /* end of  'updateState()' */
> So, the engine works well. 
> I think this is a critical bug. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.