[jboss-jira] [JBoss JIRA] Created: (JBRULES-570) Problem compiling package from xml

Javier Prieto (JIRA) jira-events at jboss.com
Tue Nov 28 03:52:55 EST 2006


Problem compiling package from xml
----------------------------------

                 Key: JBRULES-570
                 URL: http://jira.jboss.com/jira/browse/JBRULES-570
             Project: JBoss Rules
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: xml
    Affects Versions: 3.0.4
         Environment: Windows XP, Eclipse 3.2, JBoss Rules IDE 3.0.4
            Reporter: Javier Prieto
         Assigned To: Mark Proctor


There is a problem compiling package from an xml rule file with rules calling functions in the rhs body. This is an example of an xml rule file that fails:

<?xml version="1.0" encoding="UTF-8"?>
 <package name="com.sample"  
        xmlns="http://drools.org/drools-3.0"
        xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
        xs:schemaLocation="http://drools.org/drools-3.0 drools-3.0.xsd">

<function return-type="void" name="manageAlert">
        <parameter identifier="alert" type="String"/>
        <body>System.out.println(alert);</body>
</function>

<function return-type="void" name="manageRuleFired">
        <parameter identifier="ruleName" type="String"/>
        <body>System.out.println(ruleName + " fired");</body>
</function>

<rule name="Impossible Rule">
<lhs>
        <eval>1 == 2</eval>
</lhs>
<rhs>manageAlert("impossibleRule!!!"); manageRuleFired("Impossible Rule");</rhs>
</rule>
</package>

I've found a workaround. If you insert a blank char anywhere in the first sentence of the rhs body (manageAlert(...);), it works well:

<rhs>manageAlert ("impossibleRule!!!"); manageRuleFired("Impossible Rule");</rhs> (blank after manageAlert)
or, <rhs>manageAlert( "impossibleRule!!!"); manageRuleFired("Impossible Rule");</rhs> (blank after '(' )
or, <rhs> manageAlert("impossibleRule!!!"); manageRuleFired("Impossible Rule");</rhs> (blank at the begining)
or, <rhs>manageAlert("impossible Rule!!!"); manageRuleFired("Impossible Rule");</rhs> (blank in the string)
... 

If you call a Java method just before or after 'manageAlert("impossible Rule!!!");'  with a blank between them, it works well too:

<rhs>System.out.println("Hello"); manageAlert("impossibleRule!!!"); manageRuleFired("Impossible Rule");</rhs>
<rhs>manageAlert("impossibleRule!!!"); System.out.println("Hello"); manageRuleFired("Impossible Rule");</rhs>
...

I attach a test case with the xml rule file that cause the rule compilation error and the main class to test it.

-- 
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