[rules-users] Function Compilation Error when using JANINO

Ming Fang mingfang at mac.com
Wed Jul 2 13:25:19 EDT 2008


Janino does not support that style of for loop.

--Ming

On Jul 2, 2008, at 12:40 PM, "Garde, Varun (Equity Linked Technology)"  
<Varun_Garde at ml.com> wrote:

> Hello,
> I am trying to use JANINO with drools 4.0.7.
> In my rule file I have a function definition, which is throwing a
> compilation error with JANINO but works perfectly with ECLIPSE  
> compiler.
> The only janino in my classpath is v 2.5.10.
> Want to make sure I am not doing something stupid here.
>
> /* Drool File snippet */
> function List getFieldsFromDelimiter(String value, String delimiter) {
>    List fieldList = new ArrayList();
>    String[] values = value.split(delimiter);
>    for(String val: values){
>        fieldList.add(new Field(val));
>    }
>    return fieldList;
> }
>
> /* Exception trace */
> org.drools.rule.InvalidRulePackage: [ getFieldsFromDelimiter :  
> Function
> Compilation error
> getFieldsFromDelimiter (line:26): File
> com/elt/saturn/enumerations/GetFieldsFromDelimiter.java, Line 28,  
> Column
> 18: Operator ";" expected
>
> ] 
> com. 
> elt.saturn.enumerations.GetFieldsFromDelimiter.getFieldsFromDelimit
> er
>    at org.drools.rule.Package.checkValidity(Package.java:424)
>    at
> org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java: 
> 394)
>    at
> com. 
> ml.elt.saturn.core.functionality.enumerations.DroolsChainComponent.<
> init>(DroolsChainComponent.java:63)
>
> /* Class extract from dump directory */
> public class GetFieldsFromDelimiter {
>    private static final long serialVersionUID  = 400L;
>
>    public static List getFieldsFromDelimiter(String value,String
> delimiter) throws Exception {
>
>    List fieldList = new ArrayList();
>    String[] values = value.split(delimiter);
>    for(String val: values){//this is line 28
>        fieldList.add(new Field(val));
>    }
>    return fieldList;
>
>    }
> }
> /*
>
> /* Configurations supplied to the PackageBuilderConf */
> drools.dialect.java.compiler = JANINO
> drools.dialect.java.compiler.lnglevel= 1.5
>
>
> Any help would be much appreciated.
>
> Thanks,
> Varun.
> --------------------------------------------------------
>
> This message w/attachments (message) may be privileged, confidential  
> or proprietary, and if you are not an intended recipient, please  
> notify the sender, do not use or share it and delete it. Unless  
> specifically indicated, this message is not an offer to sell or a  
> solicitation of any investment products or other financial product  
> or service, an official confirmation of any transaction, or an  
> official statement of Merrill Lynch. Subject to applicable law,  
> Merrill Lynch may monitor, review and retain e-communications (EC)  
> traveling through its networks/systems. The laws of the country of  
> each sender/recipient may impact the handling of EC, and EC may be  
> archived, supervised and produced in countries other than the  
> country in which you are located. This message cannot be guaranteed  
> to be secure or error-free. This message is subject to terms  
> available at the following link: http://www.ml.com/e-communications_terms/ 
> . By messaging with Merrill Lynch you consent to the foregoing.
> --------------------------------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users



More information about the rules-users mailing list