Bug 777782 (SOA-298)

Summary: org.mvel.CompileException: variable already defined within scope
Product: [JBoss] JBoss Enterprise SOA Platform 4 Reporter: Fernando Meyer <fmcamargo>
Component: JBoss RulesAssignee: Fernando Meyer <fmcamargo>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 4.2 Beta 1   
Target Milestone: ---   
Target Release: 4.2 Beta 2   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/SOA-298
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-01-10 16:28:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Fernando Meyer 2008-01-09 17:14:36 UTC
project_key: SOA

Reported by Alexander Bagerman.

The following rule and code snippet raises the problem:

rule "rule"
    dialect "mvel"
    when
        $p : Person( $likes : likes )
    then
        Cheese c = new Cheese( $likes );
        System.out.println( $p + " -> " + c );
        insert( c );
end

// snippet
            Person bob = new Person( "Bob", "stilton" );
            Person mark = new Person( "Mark", "brie" );
            workingMemory.insert( bob );
            workingMemory.insert( mark );
            workingMemory.fireAllRules();

The exception is:

Caused by: org.mvel.CompileException: variable already defined within scope: class com.sample.Cheese c
at org.drools.base.mvel.DroolsMVELFactory.createVariable(DroolsMVELFactory.java:218)
at org.mvel.ast.TypedVarNode.getReducedValueAccelerated(TypedVarNode.java:43)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
at org.mvel.CompiledExpression.getValue(CompiledExpression.java:108)
at org.mvel.MVEL.executeExpression(MVEL.java:235)
at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:47)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:550)

Comment 1 Fernando Meyer 2008-01-09 17:14:57 UTC
Link: Added: This issue is related to JBRULES-1397


Comment 2 Fernando Meyer 2008-01-10 16:28:47 UTC
Patch applied