{"action":"created","issue":{"url":"https://api.github.com/repos/opensagres/xdocreport/issues/111","repository_url":"https://api.github.com/repos/opensagres/xdocreport","labels_url":"https://api.github.com/repos/opensagres/xdocreport/issues/111/labels{/name}","comments_url":"https://api.github.com/repos/opensagres/xdocreport/issues/111/comments","events_url":"https://api.github.com/repos/opensagres/xdocreport/issues/111/events","html_url":"https://github.com/opensagres/xdocreport/issues/111","id":130059449,"number":111,"title":"Table Repeat Not working when there's two of them","user":{"login":"jwatters1981","id":1375755,"avatar_url":"https://avatars.githubusercontent.com/u/1375755?v=3","gravatar_id":"","url":"https://api.github.com/users/jwatters1981","html_url":"https://github.com/jwatters1981","followers_url":"https://api.github.com/users/jwatters1981/followers","following_url":"https://api.github.com/users/jwatters1981/following{/other_user}","gists_url":"https://api.github.com/users/jwatters1981/gists{/gist_id}","starred_url":"https://api.github.com/users/jwatters1981/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwatters1981/subscriptions","organizations_url":"https://api.github.com/users/jwatters1981/orgs","repos_url":"https://api.github.com/users/jwatters1981/repos","events_url":"https://api.github.com/users/jwatters1981/events{/privacy}","received_events_url":"https://api.github.com/users/jwatters1981/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-01-31T00:58:58Z","updated_at":"2016-10-03T18:41:36Z","closed_at":null,"body":"Hi,\r\n\r\ni'm seeing an issue where I put two fields as list in FieldMetaData but only one gets populated.\r\n\r\n```java\r\n            IXDocReport report = XDocReportRegistry.getRegistry().loadReport(\r\n                    in, TemplateEngineKind.Velocity);\r\n\r\n            // 2) Create fields metadata to manage lazy loop (#forech velocity)\r\n            // for table row.\r\n            FieldsMetadata metadata = new FieldsMetadata();\r\n          \r\n            metadata.addFieldAsList(\"bsupport_FR.nameb\");\r\n            report.setCacheOriginalDocument(false);\r\n            \r\n            report.setFieldsMetadata(metadata);\r\n\r\n            // 3) Create context Java model\r\n            IContext context = report.createContext();\r\n\t\t\tList<Map<String, String>> developers = new ArrayList<Map<String,String>>();\r\n            Map<String,String> developer1 = new HashMap<String, String>();\r\n            developer1.put(\"nameb\", \"ZERR\");\r\n            developers.add(developer1);\r\n            context.put(\"bsupport_FR\", developers);\r\n\r\n            \r\n            metadata.addFieldAsList(\"support_FR.name\");\r\n\r\n            List<Map<String,String>> developers2 = new ArrayList<Map<String,String>>();\r\n\r\n            \r\n            Map<String,String> developer2 = new HashMap<String, String>();\r\n            developer2.put(\"name\", \"Leclercq\");\r\n           \r\n            developers2.add(developer2);\r\n           context.put(\"support_FR\", developers2);\r\n````\r\nDoesn't fill in both tables.\r\nThe weird thing is if I change the bsupport_FR to start with a letter after s (the first letter of the other list variable) and update the document it works.  \r\nI've attached a sample, I'm happy to fix if I can just get some general direction on where the problem is\r\n[issue.zip](https://github.com/opensagres/xdocreport/files/111080/issue.zip)\r\n\r\n\r\nThanks,\r\nJohn\r\n"},"comment":{"url":"https://api.github.com/repos/opensagres/xdocreport/issues/comments/251189511","html_url":"https://github.com/opensagres/xdocreport/issues/111#issuecomment-251189511","issue_url":"https://api.github.com/repos/opensagres/xdocreport/issues/111","id":251189511,"user":{"login":"townsendr","id":22600322,"avatar_url":"https://avatars.githubusercontent.com/u/22600322?v=3","gravatar_id":"","url":"https://api.github.com/users/townsendr","html_url":"https://github.com/townsendr","followers_url":"https://api.github.com/users/townsendr/followers","following_url":"https://api.github.com/users/townsendr/following{/other_user}","gists_url":"https://api.github.com/users/townsendr/gists{/gist_id}","starred_url":"https://api.github.com/users/townsendr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/townsendr/subscriptions","organizations_url":"https://api.github.com/users/townsendr/orgs","repos_url":"https://api.github.com/users/townsendr/repos","events_url":"https://api.github.com/users/townsendr/events{/privacy}","received_events_url":"https://api.github.com/users/townsendr/received_events","type":"User","site_admin":false},"created_at":"2016-10-03T18:41:36Z","updated_at":"2016-10-03T18:41:36Z","body":"We have seen this same issue today, and have resorted to renaming fields to avoid it.\r\n\r\nThe problem is in fr.opensagres.xdocreport.document.preprocessor.sax.TransformedBufferedDocumentContentHandler,\r\nin the getProcessRowResult() method (line 182 in version 1.0.5), where it checks if the row contains any of the list fields.  It does that comparison using String.contains(), which looks for the substring.  The root problem is the use of substring on an unbounded string - a list field of \"foo.bar\" will match to any other field that contains that string, such as \"foo.bar_2\", \"other_foo.bar\", \"Kangafoo.barToo\", etc.\r\n\r\nIdeally the search would either parse the content first to locate the exact field name and use String.equals(), or else it would use a bounded search, looking for exact string matches between \"${\" and \"}\", with no extra characters except whitespace."}}
{"actor":{"display_login":"townsendr"}}