[
http://jira.jboss.com/jira/browse/JBRULES-759?page=comments#action_12357772 ]
Brugger Antony commented on JBRULES-759:
----------------------------------------
I have a case where this issue is not solved with JBoss Rules 3.0.5.
If I have a rule like this one in my DRL file:
rule "Search_date_1"
when
folder : InvalidityDossier(proposedEndInvalidityDate == null, endInvalidityDate == null,
passageInvalidityDate > (new DateTime()))
then
folder.setSearchDate(folder.getDueDate());
System.out.println("Search_date_1");
end
[InvalidityDossier is a Java Bean class with getter and setter for
proposedEndInvalidityDate, endInvalidityDate, passageInvalidityDate and searchDate
attributes]
The following exception occurs on the second call to addPackage on ruleBase
(ruleBase.addPackage(pkg);):
java.lang.NullPointerException
at
be.gfdi.proto.drl.Rule_Search_date_1_0ReturnValue0Invoker.getMethodBytecode(Rule_Search_date_1_0ReturnValue0Invoker.java:32)
at
be.gfdi.proto.drl.Rule_Search_date_1_0ReturnValue0Invoker.equals(Rule_Search_date_1_0ReturnValue0Invoker.java:61)
at org.drools.rule.ReturnValueConstraint.equals(Unknown Source)
at org.drools.common.BetaNodeBinder.equals(Unknown Source)
at org.drools.reteoo.LeftInputAdapterNode.equals(Unknown Source)
at java.util.HashMap.eq(HashMap.java:274)
at java.util.HashMap.get(HashMap.java:323)
at org.drools.reteoo.ReteooBuilder.attachNode(Unknown Source)
at org.drools.reteoo.ReteooBuilder.addRule(Unknown Source)
at org.drools.reteoo.ReteooBuilder.addRule(Unknown Source)
at org.drools.reteoo.ReteooRuleBase.addRule(Unknown Source)
at org.drools.common.AbstractRuleBase.addPackage(Unknown Source)
at be.gfdi.proto.rule.test.JbrulesTest.testRuleBaseRemove(JbrulesTest.java:109)
at be.gfdi.proto.rule.test.JbrulesTest.main(JbrulesTest.java:37)
If I remove this rule there is no exception (of course there are other rules in the DRL
file)
CLONE -Unable to add package after it was added and removed
-----------------------------------------------------------
Key: JBRULES-759
URL:
http://jira.jboss.com/jira/browse/JBRULES-759
Project: JBoss Rules
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Reteoo
Affects Versions: 3.0.4
Environment: Windows2000 Advanced Server
JBRules3.0.4
Reporter: Brugger Antony
Assigned To: Edson Tirelli
Fix For: 3.0.5
Unable remove a rule package when it was added after it has been added and removed.
I have seen the issue [#JBRULES-358]. My test go a little far than [#JBRULES-358].
I remove the package again when it was added for the seconn time, then an exception was
thrown.
My test case is:
public void testRuleBaseRemove() throws Exception
{
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
File file = new File("test.drl");
//add and remove
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(new FileReader(file));
Package pkg = builder.getPackage();
ruleBase.addPackage(pkg);
ruleBase.removePackage(pkg.getName());
//add and remove again
builder = new PackageBuilder();
builder.addPackageFromDrl(new FileReader(file));
pkg = builder.getPackage();
ruleBase.addPackage(pkg);
ruleBase.removePackage(pkg.getName());
}
the exception is throw:
java.lang.NullPointerException
at org.drools.reteoo.HashedObjectSinkList.remove(HashedObjectSinkList.java:102)
at org.drools.reteoo.ObjectTypeNode.remove(ObjectTypeNode.java:245)
at org.drools.reteoo.AlphaNode.remove(AlphaNode.java:211)
at org.drools.reteoo.AlphaNode.remove(AlphaNode.java:211)
at org.drools.reteoo.LeftInputAdapterNode.remove(LeftInputAdapterNode.java:285)
at org.drools.reteoo.TerminalNode.remove(TerminalNode.java:297)
at org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:589)
at org.drools.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:244)
at org.drools.common.AbstractRuleBase.removePackage(AbstractRuleBase.java:338)
at
com.zte.ums.uep.pal.fm.osf.rules.core.RuleBaseTest.testRuleBaseRemove(RuleBaseTest.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira