[jboss-jira] [JBoss JIRA] Created: (JBRULES-1464) Comilation error : 'Syntax error on token ",", delete this token' when referencing a global in an accumulate block

Thomas Vanstals (JIRA) jira-events at lists.jboss.org
Tue Feb 12 10:37:04 EST 2008


Comilation error : 'Syntax error on token ",", delete this token' when referencing a global in an accumulate block
------------------------------------------------------------------------------------------------------------------

                 Key: JBRULES-1464
                 URL: http://jira.jboss.com/jira/browse/JBRULES-1464
             Project: JBoss Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Drl Parser/Builder
    Affects Versions: 4.0.4
         Environment: Eclise / java version "1.6.0_02"
            Reporter: Thomas Vanstals


Hello,

I'm trying to reference a global in an accumulate block and I get the following error : 

Rule Compilation error : [Rule name=Hello World, agendaGroup=MAIN, salience=0, no-loop=false]
	org/drools/examples/Rule_Hello_World_0.java (15:338) : Syntax error on token ",", delete this token
	org/drools/examples/Rule_Hello_World_0.java (41:1544) : Syntax error on token ",", delete this token


Here is a sample drl file base on the HelloWorld.drl (found in the drools samples)

---------------------------------------------------------------------------------------------------------
package org.drools.examples
 
import org.drools.examples.HelloWorldExample.Message;
import java.util.*;
 
global Message globalMessage;

rule "Hello World"
	when
		$msgList : List() 
        	from accumulate( $msg : Message(),
                             init( List result = new ArrayList(); ),
                             action( if (globalMessage.getMessage() == $msg.getMessage()) result.add($msg); ),
                             result( result ))
	then
		System.out.println("Size: " +  $msgList.size() );  
end
---------------------------------------------------------------------------------------------------------

If I use 

action( if ("Hello World" == $msg.getMessage()) result.add($msg); ),

instead of 

action( if (globalMessage.getMessage() == $msg.getMessage()) result.add($msg); ),

it's working great... 


Regards, 

Thomas


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