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

Duplicate parameter error while trying to use pattern bound variables or globals in accumulate function

    XMLWordPrintable

    Details

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

      JDK 1.5.0_13, Ubuntu 7.10

      Description

      Whenever I attempt to reference a pattern bound variable (declared outside of accumulate) or a global from within an accumulate function, I get a "Duplicate parameter" error.

      Example of pattern bound variable:

      rule "Test"
      when
      $obj: SomeObject()
      Integer() from accumulate( AnotherObject() , init (int total = 0 ), action ( total += $obj.getValue(); ), reverse ( total -= $obj.getValue(); ), result ( total) )
      then
      System.out.println("HI!");
      end

      The same happens when if I attempt to use a global. Here is an exact stacktrace of the error:
      org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule
      name=Daily Core Hours, agendaGroup=MAIN, salience=0, no-loop=false]
      com/kronos/webta/service/smarttime/rules/Rule_Daily_Core_Hours_0.java
      (32:1301) : Duplicate parameter $schedOut
      com/kronos/webta/service/smarttime/rules/Rule_Daily_Core_Hours_0.java
      (32:1330) : Duplicate parameter $schedIn
      com/kronos/webta/service/smarttime/rules/Rule_Daily_Core_Hours_0.java
      (41:1735) : Duplicate parameter $schedOut
      com/kronos/webta/service/smarttime/rules/Rule_Daily_Core_Hours_0.java
      (41:1764) : Duplicate parameter $schedIn
      com/kronos/webta/service/smarttime/rules/Rule_Daily_Core_Hours_0.java
      (51:2330) : Duplicate parameter $schedOut
      com/kronos/webta/service/smarttime/rules/Rule_Daily_Core_Hours_0.java
      (51:2359) : Duplicate parameter $schedIn
      com/kronos/webta/service/smarttime/rules/Rule_Daily_Core_Hours_0.java
      (58:2738) : Duplicate parameter $schedOut
      com/kronos/webta/service/smarttime/rules/Rule_Daily_Core_Hours_0.java
      (58:2767) : Duplicate parameter $schedIn

      at org.drools.rule.Package.checkValidity(Package.java:424)
      at
      org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:364)
      at
      com.kronos.webta.service.smarttime.rules.maxiflex.FlowTest.setUpBeforeClass(FlowTest.java:79)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at
      org.junit.internal.runners.ClassRoadie.runBefores(ClassRoadie.java:49)
      at
      org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:36)
      at
      org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
      at
      org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
      at
      org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at
      org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      at
      org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      at
      org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      at
      org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  tirelli Edson Tirelli
                  Reporter:
                  emilesvt Eric Miles
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: