[jboss-jira] [JBoss JIRA] (DROOLS-1337) A FQN inline cast followed by a method invocation causes an ArrayIndexOutOfBoundsException
Mario Fusco (JIRA)
issues at jboss.org
Wed Oct 19 12:35:00 EDT 2016
Mario Fusco created DROOLS-1337:
-----------------------------------
Summary: A FQN inline cast followed by a method invocation causes an ArrayIndexOutOfBoundsException
Key: DROOLS-1337
URL: https://issues.jboss.org/browse/DROOLS-1337
Project: Drools
Issue Type: Bug
Components: core engine
Reporter: Mario Fusco
Assignee: Mario Fusco
An inline cast using a fully qualified name followed by a method invocation causes an ArrayIndexOutOfBoundsException as in the following test case:
{code}
@Test
public void testInlineCastWithFQNAndMethodInvocation() throws Exception {
String str =
"import org.drools.compiler.Person;\n" +
"global java.util.List list;\n" +
"rule R1 when\n" +
" Person( name == \"mark\", $x : address#org.drools.compiler.LongAddress.country.substring(1) )\n" +
"then\n" +
" list.add($x);" +
"end\n";
KnowledgeBase kbase = loadKnowledgeBaseFromString(str);
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
List<String> list = new ArrayList<String>();
ksession.setGlobal( "list", list );
Person mark1 = new Person("mark");
mark1.setAddress(new LongAddress("uk"));
ksession.insert(mark1);
assertEquals(1, ksession.fireAllRules());
assertEquals(1, list.size());
assertEquals("k", list.get(0));
ksession.dispose();
}
{code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list