[rules-users] RuleBase Question

malkhafaji moe.alkhafaji at medcpu.com
Thu Jun 10 20:43:45 EDT 2010


Hello,

I have two questions. Hopefully they are very simple:

1. If I wanted to dynamically update a package in the RuleBase because I
found out that the drl was updated on disk, can I just do this:

ruleBase.addPackage(myPackage);

And this will automatically replace (remove the old one, and add the new
one)? Or do I have to implicitly first remove the existing one and THEN add
the modified one again?

I have the following code:

if (ruleBase.getPackage(onePackage.getName()) != null) {
	ruleBase.removePackage(onePackage.getName());
}
ruleBase.addPackage(onePackage);

Is this a code practice to do?

2. My second question is, the statement above in the body of the IF block,
threw the following exception:

Exception in thread "AdminHandler_0_123877285495354"
java.lang.NullPointerException
INFO|7032/0|10-06-10 13:43:55|	at
org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:235)
INFO|7032/0|10-06-10 13:43:55|	at
org.drools.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:413)
INFO|7032/0|10-06-10 13:43:55|	at
org.drools.common.AbstractRuleBase.removeRule(AbstractRuleBase.java:729)
INFO|7032/0|10-06-10 13:43:55|	at
org.drools.common.AbstractRuleBase.removePackage(AbstractRuleBase.java:657)
INFO|7032/0|10-06-10 13:43:55|	at [statement in the IF block above]

Any ideas why that is?

Thanks.
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/RuleBase-Question-tp887326p887326.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list