[
https://issues.jboss.org/browse/JBRULES-3673?page=com.atlassian.jira.plug...
]
RH Bugzilla Integration updated JBRULES-3673:
---------------------------------------------
Bugzilla References:
https://bugzilla.redhat.com/show_bug.cgi?id=869967
Fact metadata declared in a POJO are lost when declaring fact
metadata in DRL
------------------------------------------------------------------------------
Key: JBRULES-3673
URL:
https://issues.jboss.org/browse/JBRULES-3673
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Reporter: Mario Fusco
Assignee: Mario Fusco
Assume a POJO is used as a fact and annotated with @Position as follows:
public class PositionAnnotatedEvent {
@Position(1)
private String arg1;
@Position(0)
private String arg0;
// getters and setters
}
When I add some metadata to this class in DRL, for example:
declare org.jboss.qa.brms.bre.regression.POJOAnnotationMergeTest.PositionAnnotatedEvent
@role(event)
end
Then the following rule using positional arguments does not compile, producing an
IndexOutOfBoundsException with message 'Error trying to access field at position
0'. The same rule with named arguments compiles:
rule 'sample rule'
when
org.jboss.qa.brms.bre.regression.POJOAnnotationMergeTest.PositionAnnotatedEvent(
'value1', 'value2'; )
then
end
The relevant stack trace follows:
java.lang.IndexOutOfBoundsException: Error trying to access field at position 0
at org.drools.factmodel.ClassDefinition.getField(ClassDefinition.java:162)
at org.drools.rule.builder.PatternBuilder.processPositional(PatternBuilder.java:432)
at
org.drools.rule.builder.PatternBuilder.processConstraintsAndBinds(PatternBuilder.java:392)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:310)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:131)
at org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:65)
at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:80)
at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2578)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:970)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:456)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:643)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:41)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira