The first one is a bug, that is fixed in RC3 when it comes out.

The second one is wrong, as the function needs to return a boolean for it to
make sense in an eval.


Michael.

On 5/8/06, Kihm, Christian <[EMAIL PROTECTED]> wrote:

Hi,



we plan to migrate our rule-base vom drools 2.5 to jbossrules. But we
have many Problems to get it run. If there is for example a function
with an array parameter like this:



function void yourFunction(String[] args) {

      /* code goes here*/

}



Then the excecution ends with following error:



org.drools.rule.InvalidRulePackage: unknown:5:45 Unexpected token '['

unknown:5:45 Unexpected token '['



      at org.drools.rule.Package.checkValidity(Package.java:378)

      at
org.drools.reteoo.RuleBaseImpl.addPackage(RuleBaseImpl.java:303)

      at com.sample.DroolsTest.readRule(DroolsTest.java:77)

      at com.sample.DroolsTest.main(DroolsTest.java:23)





For tests we have to some boxing/outboxing with the array parameter like
this:



function void yourFunction (List argsM){

      String[] args = (String[])argsM.toArray(new String[argsM.size()]);

/* code goes here*/

}





rule "argTest"



      salience 11

      no-loop true



      when

            eval( yourFunction(Arrays.asList(new String[] {"1", "2",
"6"})) )

      then

            System.out.println("it works");



End



Butt his ends with following error:



org.drools.rule.InvalidRulePackage: Rule Compilation error The method
yourFunction(List) is undefined for the type argTest



Can anyone please give me a hint why this going wrong?



Kind regards

Christian



Reply via email to