Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-1464

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.0.4
    • Fix Version/s: 4.0.5, 5.0.0.M1
    • Component/s: drools-compiler
    • Labels:
      None
    • Environment:

      Eclise / java version "1.6.0_02"

      Description

      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

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                tirelli Edson Tirelli
                Reporter:
                thomasvst Thomas Vanstals
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: