Bug 724357 (BRMS-303)

Summary: NPE with BigDecimal,compareTo
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Jeff DeLong <jdelong>
Component: BRE (Expert, Fusion)Assignee: Edson Tirelli <ed.tirelli>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: high    
Version: 5.0.1CC: maarten.daalder
Target Milestone: ---   
Target Release: 5.1.0 GA   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/BRMS-303
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Eclipse with JBTools 3.1 but using DroolsRuntime jars from SOA-P 5.0
Last Closed: 2010-12-07 23:36:08 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 Jeff DeLong 2010-04-15 19:55:11 UTC
Date of First Response: 2010-04-16 20:09:53
securitylevel_name: Public

rule 'MaxPriceComparisonRule1'
        ...
        dialect "mvel"
The rule

when        
       $aRBPVO: AutomatedRiskBasedPricingVO($maxPrice: maxPrice)
       $rBPVO: RiskBasedPricingVO(ysp < $maxPrice)
then
   ...
        
end

results in an exception:

Exception in thread "main" java.lang.NullPointerException
    at java.math.BigDecimal.compareTo(BigDecimal.java:2533)
    at org.drools.base.evaluators.ComparableEvaluatorsDefinition$BigDecimalLessEvaluator.evaluateCachedLeft(ComparableEvaluatorsDefinition.java:241)
    at org.drools.rule.VariableRestriction.isAllowedCachedLeft(VariableRestriction.java:109)
    at org.drools.rule.VariableConstraint.isAllowedCachedLeft(VariableConstraint.java:106)
    at org.drools.common.SingleBetaConstraints.isAllowedCachedLeft(SingleBetaConstraints.java:138)
    at org.drools.reteoo.JoinNode.assertLeftTuple(JoinNode.java:114)
    at org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:145)
    at org.drools.reteoo.CompositeLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:57)
    at org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:142)
    at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:360)
    at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:344)
    at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:185)
    at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:146)
    at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1053)
    at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1008)
    at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:795)
    at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:216)
    at com.ap.test.TestRiskPricing.main(TestRiskPricing.java:103)



when using the drools runtime with jars from SOA-P 5.0 (should be the same jars as BRMS 5.1.

The rule executes without exceptions using the drools runtime created with jars from JB Tools 3.1. I cannot find a JIRA issue in Drools to cross-reference.

Comment 1 Jeff DeLong 2010-04-15 20:01:18 UTC
I should have specified that maxPrice is a BigDecimal.

Comment 3 Jeff DeLong 2010-04-18 01:05:35 UTC
Edson,

I think the issue is fixed in 5.1; it seems to work with the jars in the JBoss Tools 3.1. I just could not find a JIRA issue that shows it being fixed? As far as a timeframe, it is a PoC, so for now the rule is not being included in the package.

Jeff

Comment 5 Dana Mison 2010-10-27 03:06:26 UTC
Release Notes Text: Added: test


Comment 6 Dana Mison 2010-10-27 03:13:37 UTC
Release Notes Text: Removed: test 


Comment 7 David Le Sage 2010-11-04 05:28:53 UTC
Release Notes Docs Status: Added: Not Yet Documented
Writer: Added: Darrin


Comment 8 Petr Široký 2010-11-29 17:21:22 UTC
Verified fixed in BRMS 5.1.0 ER4.

Comment 9 David Le Sage 2010-12-07 23:35:14 UTC
Temporarily reopening to update release notes information.

Comment 10 David Le Sage 2010-12-07 23:35:32 UTC
Labels: Removed: rn-dmison rn-open Added: rn-dlesage rn-done-resolved


Comment 11 David Le Sage 2010-12-07 23:35:59 UTC
Release Notes Docs Status: Removed: Not Yet Documented Added: Documented as Resolved Issue
Writer: Removed: Darrin Added: dlesage
Release Notes Text: Added: https://jira.jboss.org/browse/JBRULES-2102

If the right-hand side of an integer to integer comparison was a null pointer, an exception would occur.  This was because one of the functions lacked a check for null values on an object.  This has now been corrected, so these exceptiosn will no longer occur.