[jboss-jira] [JBoss JIRA] (DROOLS-1418) Binding of List stored in Map doesn't work in special case

Matteo Mortari (JIRA) issues at jboss.org
Thu Jan 26 10:45:00 EST 2017


    [ https://issues.jboss.org/browse/DROOLS-1418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13354020#comment-13354020 ] 

Matteo Mortari commented on DROOLS-1418:
----------------------------------------

Simplified reproducer:

{code:java}
    public static class MapHolder {
        private Map<String, List<String>> fieldMap;
        public Map<String, List<String>> getFieldMap() {
            return fieldMap;
        }
        public void setFieldMap(Map<String, List<String>> fieldMap) {
            this.fieldMap = fieldMap;
        }
    }
    
    @Test
    public void testMapOperatorWithPojoGenerics() {
        String drl1 = "package "+this.getClass().getPackage().getName()+";\n" + 
                "import " + MapHolder.class.getCanonicalName() + ";\n" +
                "rule R1 when\n" + 
                "  MapHolder( $a : fieldMap[\"keyA\"] )\n" + 
                "then\n" + 
                "   System.out.println($a);\n" +
                "end\n" + 
                "";

        KieSession kieSession = new KieHelper()
                    .addContent(drl1, ResourceType.DRL)
                    .build().newKieSession();
        
        Map<String, List<String>> items = new HashMap<>();
        items.put("keyA", new ArrayList<String>() {{ add("a"); }});
        // go !
        MapHolder m = new MapHolder();
        m.setFieldMap(items);
        
        kieSession.insert(m);

        assertEquals(1, kieSession.fireAllRules() );
    }
{code}


> Binding of List stored in Map doesn't work in special case
> ----------------------------------------------------------
>
>                 Key: DROOLS-1418
>                 URL: https://issues.jboss.org/browse/DROOLS-1418
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine
>    Affects Versions: 7.0.0.Beta5
>            Reporter: Jozef Marko
>            Assignee: Mario Fusco
>              Labels: dtable_testday_preparation, reported-by-qe
>         Attachments: reproducer.zip
>
>
> User has possibility to bind a List stored as item of a Map in his rule. However this dosn't work in one special case. For more details see the steps to reproduce.
> This issue was discussed with [~tari_manga] and he also provided the workaround used in reproducer. Thanks.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list