[rules-users] Bug with removePackage/removeRule

Dirk Bergstrom dirk at juniper.net
Thu Jan 24 20:09:48 EST 2008


I believe this is a bug.  After I remove a rule or package from the ruleBase,
newly added rules fail to "see" objects in the working memory.  Attached is a
test case, and below is the output from it.

Drools 4.0.4
Java 1.5.0.13

Start
RuleBase created
Adding rules about 'tom':
package tom;
import test.Tester.Record;
rule "Find tom"
when
 $rec : Record( field1 == "tom" )
then
 System.out.println("Find 'tom' " + $rec.dump());
end

inserting record 1:"tom",
inserting record 2:"fred",
inserting record 3:"harry",
inserting record 4:"fred",
inserting record 5:"ed",
inserting record 6:"tom",
inserting record 7:"sreeni",
inserting record 8:"jill",
inserting record 9:"ed",
inserting record 10:"tom",

fireAllRules()
Find 'tom' 10:"tom",
Find 'tom' 6:"tom",
Find 'tom' 1:"tom",

adding rules about 'fred':
package fred;
import test.Tester.Record;
rule "Find fred"
when
 $rec : Record( field1 == "fred" )
then
 System.out.println("Find 'fred' " + $rec.dump());
end

Find 'fred' 4:"fred",
Find 'fred' 2:"fred",
As expected, 'fred' is found.

Removing package tom (same bug if you use "ruleBase.removeRule").
ruleBase.removePackage("tom");

adding rules about 'ed':
package ed;
import test.Tester.Record;
rule "Find ed"
when
 $rec : Record( field1 == "ed" )
then
 System.out.println("Find 'ed' " + $rec.dump());
end

No 'ed' is found!

Changing record 3 to 'ed'
fireAllRules()
Find 'ed' 3:"ed",
Only the newly updated 'ed' is found.



-- 
Dirk Bergstrom               dirk at juniper.net
_____________________________________________
Juniper Networks Inc.,          Computer Geek
Tel: 408.745.3182           Fax: 408.745.8905
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Tester.java
Type: text/x-java
Size: 5069 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20080124/45cee10e/attachment.bin 


More information about the rules-users mailing list