[
http://jira.jboss.com/jira/browse/JBRULES-1264?page=all ]
Mark Proctor updated JBRULES-1264:
----------------------------------
Workaround Description:
Set alphaNodeHashingThreshold to 0.
NPE at BaseObjectClassFieldExtractor.getLongValue with null fields
------------------------------------------------------------------
Key: JBRULES-1264
URL:
http://jira.jboss.com/jira/browse/JBRULES-1264
Project: JBoss Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 4.0.2
Reporter: Alexandre Gattiker
Assigned To: Mark Proctor
Removing one of the three rules magically solves the problem.
java.lang.NullPointerException
at
org.drools.base.extractors.BaseObjectClassFieldExtractor.getLongValue(BaseObjectClassFieldExtractor.java:106)
at org.drools.base.ClassFieldExtractor.getLongValue(ClassFieldExtractor.java:203)
at
org.drools.reteoo.CompositeObjectSinkAdapter$HashKey.setValue(CompositeObjectSinkAdapter.java:467)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:292)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
at org.drools.reteoo.Rete.assertObject(Rete.java:177)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:201)
at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:886)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:858)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:659)
at com.sample.DroolsTest.main(DroolsTest.java:21)
package com.sample;
import java.io.InputStreamReader;
import java.io.Reader;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.compiler.PackageBuilder;
import org.drools.rule.Package;
public class DroolsTest
{
public static final void main(String[] args)
{
try
{
RuleBase ruleBase = readRule();
WorkingMemory workingMemory = ruleBase.newStatefulSession();
workingMemory.insert(new Attribute());
workingMemory.insert(new Message());
workingMemory.fireAllRules();
}
catch (Throwable t)
{
t.printStackTrace();
}
}
private static RuleBase readRule() throws Exception
{
Reader source = new
InputStreamReader(DroolsTest.class.getResourceAsStream("/Sample.drl"));
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(source);
Package pkg = builder.getPackage();
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(pkg);
return ruleBase;
}
public static class Message
{
//empty
}
public static class Attribute
{
public Integer getValue()
{
return null;
}
}
}
package com.sample
import com.sample.DroolsTest.Message;
import com.sample.DroolsTest.Attribute;
rule "rule_1"
when
Message()
Attribute(value == 1)
then
System.err.println("case 1");
end
rule "rule_2"
when
Message()
Attribute(value == 2)
then
System.err.println("case 2");
end
rule "rule_3"
when
Message()
$a:Attribute(value == 3)
then
System.err.println("case 3");
end
--
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