[jboss-jira] [JBoss JIRA] (DROOLS-903) Drools map usage nullpointer exception
Mario Fusco (JIRA)
issues at jboss.org
Fri Sep 4 05:34:00 EDT 2015
[ https://issues.jboss.org/browse/DROOLS-903?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mario Fusco resolved DROOLS-903.
--------------------------------
Resolution: Out of Date
Provided that the rulesParamMap always has a not null value for key "01" (otherwise the problem is in your data or you should add the constraint getRulesParamMap().get("01") != null to your rule) I think that your problem could be caused by the fact that you're using the 'rules' declaration also inside the pattern that could be rewritten as it follows
{{Rules(getRulesParamMap().get("01").getActual()>=getRulesParamMap().get("01").getThreshold())}}
While using the declaration inside its own pattern is not technical wrong, it is considered bad style and can cause some problem on 5.x that anyway have been already solved on 6.x.
> Drools map usage nullpointer exception
> --------------------------------------
>
> Key: DROOLS-903
> URL: https://issues.jboss.org/browse/DROOLS-903
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 5.6.0.Final
> Reporter: Abrham Kampur
> Assignee: Mario Fusco
>
> My rules file looks like
> rule"rule1 test"
> when rules:Rules(rules.getRulesParamMap().get("01").getActual()>=rules.getRulesParamMap().get("01").getThreshold())
> then
> RuleResult ruleResult=new RuleResult()
> ruleResult.setRulePassed(false);
> rules.getRulesResultMap().put("01",ruleResult);
> System.out.println("Rule failed. ");
> retract(rules)
> end
> Note: Rules is a clas which has rulesParamMap and ruleResultMap attributes.
> Ruleresult is also a class with fields actual and threshold
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list