struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Bernhagen (JIRA)" <>
Subject [jira] [Created] (WW-4301) includeProperties Does Not Work with a List of Lists
Date Wed, 12 Mar 2014 22:06:45 GMT
Andrew Bernhagen created WW-4301:

             Summary: includeProperties Does Not Work with a List of Lists
                 Key: WW-4301
             Project: Struts 2
          Issue Type: Bug
          Components: Plugin - JSON
    Affects Versions: 2.3.16
            Reporter: Andrew Bernhagen
            Priority: Minor

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:

public List<List<String>> getListOfLists() {
	return listOfLists;

My struts.xml is defined as follows:

<action name="GetData" method="loadData"
	<result type="json" >
		<param name="ignoreHierarchy">false</param>
		<param name="includeProperties">listOfLists\[\d+\]\[\d+\]</param>

However, the include patterns that are constructed within JSONUtil are not accurate.  Instead
of making the expected pattern that would work:


Only the following are created:


Because the first "listOfLists" is not created, the property is excluded in the results.

This all happens because of line 463 in JSONUtil:

addPattern(results, patternExpr.substring(0, patternExpr.lastIndexOf(includePatternData.get(ARRAY_BEGIN_STRING).get(type))),

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

View raw message