[jboss-jira] [JBoss JIRA] Created: (JBPM-853) Attribute 'expression' not taken from Condition element

Arjan van Bentem (JIRA) jira-events at lists.jboss.org
Wed Feb 28 04:04:36 EST 2007


Attribute 'expression' not taken from Condition element
-------------------------------------------------------

                 Key: JBPM-853
                 URL: http://jira.jboss.com/jira/browse/JBPM-853
             Project: JBoss jBPM
          Issue Type: Bug
          Components: Core Engine
    Affects Versions: jBPM jPDL 3.2 beta 2
         Environment: All
            Reporter: Arjan van Bentem
         Assigned To: Tom Baeyens


The <condition> element allows for either specifying an attribute 'expression', or for giving the expression as the text of the element itself. So, both

    <condition>#{true}</condition>   

and

    <condition expression="#{true}"/>   

should work. However, the latter expression is ignored (and does not get stored in the database but results in a zero-length (non-null) value in column DECISION_ in JBPM_TRANSITIONS instead). This is caused by org.dom4j.Element#getTextTrim() returning en empty String rather than null.

Fix: replace line 745 of JpdlXmlReader (version 1.7)

http://fisheye.jboss.com/browse/JBPM/jbpm.3/jpdl/jar/src/main/java/org/jbpm/jpdl/xml/JpdlXmlReader.java?r=1.7#l731
739 String condition = transitionElement.attributeValue("condition");
740 if (condition==null) {
741   Element conditionElement = transitionElement.element("condition");
742   if (conditionElement!=null) {
743     condition = conditionElement.getTextTrim();
744     // for backwards compatibility
745     if (condition==null) {
746       condition = conditionElement.attributeValue("expression");
747     }
748   }
749 }   

with

745 if (condition==null || condition.length()==0) {

In the DecisionConditionsTest Unit test one could change one (and ONLY one) of the conditions to use the attribute rather than the element text. Like on line 42 of DecisionConditionsTest (version 1.1) replace

http://fisheye.jboss.com/browse/JBPM/jbpm.3/jpdl/jar/src/test/java/org/jbpm/jpdl/exe/DecisionConditionsTest.java?r=1.1#l40
41   	    "    <transition name='lead' to='put it in the lead db'>" +
42 	    "      <condition>#{budget > 100}</condition>" +
43 	    "    </transition>" +

with

42          "      <condition expression='#{budget > 100}'/>" +

Thanks to cdart_rrr for pointing this out in the forums.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list