[
https://issues.apache.org/jira/browse/WW-4301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14095302#comment-14095302
]
ASF subversion and git services commented on WW-4301:
-----------------------------------------------------
Commit 120830f1ac46b48eb6797e07c1365833c435d8cf in struts's branch
refs/heads/develop from [~lukaszlenart]
[ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=120830f ]
WW-4301 Adds additional use-case to proof the problem exists
> includeProperties Does Not Work with a List of Lists
> ----------------------------------------------------
>
> Key: WW-4301
> URL: https://issues.apache.org/jira/browse/WW-4301
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - JSON
> Affects Versions: 2.3.16
> Reporter: Andrew Bernhagen
> Priority: Minor
> Labels: json
> Fix For: 2.5
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> I found this issue when using server-side processing with JQuery Datatables
> and attempting to populate.
> Say I have this getter/field on my action:
> {code:java}
> public List<List<String>> getListOfLists() {
> return listOfLists;
> }
> {code}
> My struts.xml is defined as follows:
> {code:xml}
> <action name="GetData" method="loadData"
> class="com.example.web.action.WebAction">
> <result type="json" >
> <param name="ignoreHierarchy">false</param>
> <param
> name="includeProperties">listOfLists\[\d+\]\[\d+\]</param>
> </result>
> </action>
> {code}
> However, the include patterns that are constructed within JSONUtil are not
> accurate. Instead of making the expected pattern that would work:
> {noformat}
> listOfLists
> listOfLists\[\d+\]
> listOfLists\[\d+\]\[\d+\]
> {noformat}
> Only the following are created:
> {noformat}
> listOfLists\[\d+\]
> listOfLists\[\d+\]\[\d+\]
> {noformat}
> Because the first "listOfLists" is not created, the property is excluded in
> the results.
> This all happens because of line 463 in JSONUtil:
> {code:java}
> addPattern(results, patternExpr.substring(0,
> patternExpr.lastIndexOf(includePatternData.get(ARRAY_BEGIN_STRING).get(type))),
> type);
> {code}
> Since we're going at the last index of the ARRAY_BEGIN_STRING string, it's
> skipping the first index. This could be updated to be smarter to build the
> include patterns as expected.
--
This message was sent by Atlassian JIRA
(v6.2#6252)