thanks. Feel free to stick to your work around, it is such a minor work
around it shouldn't cause a problem for you in future.

Michael.

On 11/28/06, Javier Prieto <[EMAIL PROTECTED]> wrote:


Ok, thanks Michael. I've reported the bug and a test case in JIRA


Michael Neale-2 wrote:
>
> Hi Javier.
>
> Yes that sounds like a bug, and you have a work around !
>
> Would you care to create a JIRA and a test case and we can make sure it
is
> fixed at least for trunk.
>
> Michael.
>
> On 11/21/06, Javier Prieto <[EMAIL PROTECTED]> wrote:
>>
>>
>> Hi,
>>
>> I'm developing an application with a GUI for rule management. It writes
a
>> drools xml rule file with the rules specified by GUI. I get a rule
>> compilation error when i read rule package from xml rule file. I think
>> it's
>> a little bug. 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>
>>
>> And this is the exception I get:
>>
>> org.drools.rule.InvalidRulePackage: Rule Compilation error The method
>> manageAlert(String) is undefined for the type Rule_Impossible_Rule_0
>>
>>         at org.drools.rule.Package.checkValidity(Unknown Source)
>>         at org.drools.common.AbstractRuleBase.addPackage(Unknown
Source)
>>         at com.sample.DroolsTest.readRule(DroolsTest.java:89)
>>         at com.sample.DroolsTest.main(DroolsTest.java:30)
>>
>> However, if i insert a blank char anywhere in the first sentence of the
>> rhs
>> body (manageAlert(...);), it works well:
>>
>> For example:
>> <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)
>> ...
>>
>> Now, I'm writing the xml file inserting a \n char at the beginning of
the
>> rhs body in order to solve it temporarily:
>> <rhs>
>> manageAlert("impossibleRule!!!"); manageRuleFired("Impossible Rule");
>> </rhs>
>>
>> I suppose it's a little bug in the addPackageFromXml (or other
addPackage
>> method) that labels a package as invalid or something similar... It
would
>> be
>> easy to fix it?
>>
>> --
>> View this message in context:
>>
http://www.nabble.com/A-bug-compiling-package-from-xml-tf2678699.html#a7471000
>> Sent from the drools - user mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>
>

--
View this message in context:
http://www.nabble.com/A-bug-compiling-package-from-xml-tf2678699.html#a7575506
Sent from the drools - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to