You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "John Lindal (JIRA)" <ji...@apache.org> on 2010/10/04 20:55:36 UTC
[jira] Created: (WW-3509) JSONResult.setIncludeProperties()
constructs incorrect patterns
JSONResult.setIncludeProperties() constructs incorrect patterns
---------------------------------------------------------------
Key: WW-3509
URL: https://issues.apache.org/jira/browse/WW-3509
Project: Struts 2
Issue Type: Bug
Components: Plugin - JSON
Affects Versions: 2.2.1
Reporter: John Lindal
// Add a pattern that does not have the indexed property
// matching (ie. list\[\d+\] becomes list).
if (patternPiece.endsWith("\\]")) {
- this.includeProperties.add(Pattern.compile(patternExpr.substring(0, patternPiece
+ this.includeProperties.add(Pattern.compile(patternExpr.substring(0, patternExpr
.lastIndexOf("\\["))));
if (LOG.isDebugEnabled())
LOG.debug("Adding include property expression: "
- + patternExpr.substring(0, patternPiece.lastIndexOf("\\[")));
+ + patternExpr.substring(0, patternExpr.lastIndexOf("\\[")));
}
this.includeProperties.add(Pattern.compile(patternExpr));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (WW-3509) JSONResult.setIncludeProperties()
constructs incorrect patterns
Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3509?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Lenart reassigned WW-3509:
---------------------------------
Assignee: Lukasz Lenart
> JSONResult.setIncludeProperties() constructs incorrect patterns
> ---------------------------------------------------------------
>
> Key: WW-3509
> URL: https://issues.apache.org/jira/browse/WW-3509
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - JSON
> Affects Versions: 2.2.1
> Reporter: John Lindal
> Assignee: Lukasz Lenart
>
> // Add a pattern that does not have the indexed property
> // matching (ie. list\[\d+\] becomes list).
> if (patternPiece.endsWith("\\]")) {
> - this.includeProperties.add(Pattern.compile(patternExpr.substring(0, patternPiece
> + this.includeProperties.add(Pattern.compile(patternExpr.substring(0, patternExpr
> .lastIndexOf("\\["))));
>
> if (LOG.isDebugEnabled())
> LOG.debug("Adding include property expression: "
> - + patternExpr.substring(0, patternPiece.lastIndexOf("\\[")));
> + + patternExpr.substring(0, patternExpr.lastIndexOf("\\[")));
> }
>
> this.includeProperties.add(Pattern.compile(patternExpr));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WW-3509) JSONResult.setIncludeProperties()
constructs incorrect patterns
Posted by "John Lindal (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3509?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12923973#action_12923973 ]
John Lindal commented on WW-3509:
---------------------------------
I don't have an explicit test case, but if you look at the entire function, patternExpr is built by concatenating multiple patternPiece's. The code in the patch is executed immediately after
patternExpr += patternPiece;
So using the index of [ in patternPiece is wrong. The index must be computed in patternExpr.
> JSONResult.setIncludeProperties() constructs incorrect patterns
> ---------------------------------------------------------------
>
> Key: WW-3509
> URL: https://issues.apache.org/jira/browse/WW-3509
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - JSON
> Affects Versions: 2.2.1
> Reporter: John Lindal
> Assignee: Lukasz Lenart
>
> // Add a pattern that does not have the indexed property
> // matching (ie. list\[\d+\] becomes list).
> if (patternPiece.endsWith("\\]")) {
> - this.includeProperties.add(Pattern.compile(patternExpr.substring(0, patternPiece
> + this.includeProperties.add(Pattern.compile(patternExpr.substring(0, patternExpr
> .lastIndexOf("\\["))));
>
> if (LOG.isDebugEnabled())
> LOG.debug("Adding include property expression: "
> - + patternExpr.substring(0, patternPiece.lastIndexOf("\\[")));
> + + patternExpr.substring(0, patternExpr.lastIndexOf("\\[")));
> }
>
> this.includeProperties.add(Pattern.compile(patternExpr));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (WW-3509) JSONResult.setIncludeProperties()
constructs incorrect patterns
Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3509?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Lenart resolved WW-3509.
-------------------------------
Resolution: Fixed
Fix Version/s: 2.2.2
Patch applied, thanks!
> JSONResult.setIncludeProperties() constructs incorrect patterns
> ---------------------------------------------------------------
>
> Key: WW-3509
> URL: https://issues.apache.org/jira/browse/WW-3509
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - JSON
> Affects Versions: 2.2.1
> Reporter: John Lindal
> Assignee: Lukasz Lenart
> Fix For: 2.2.2
>
>
> // Add a pattern that does not have the indexed property
> // matching (ie. list\[\d+\] becomes list).
> if (patternPiece.endsWith("\\]")) {
> - this.includeProperties.add(Pattern.compile(patternExpr.substring(0, patternPiece
> + this.includeProperties.add(Pattern.compile(patternExpr.substring(0, patternExpr
> .lastIndexOf("\\["))));
>
> if (LOG.isDebugEnabled())
> LOG.debug("Adding include property expression: "
> - + patternExpr.substring(0, patternPiece.lastIndexOf("\\[")));
> + + patternExpr.substring(0, patternExpr.lastIndexOf("\\[")));
> }
>
> this.includeProperties.add(Pattern.compile(patternExpr));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WW-3509) JSONResult.setIncludeProperties()
constructs incorrect patterns
Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3509?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12923868#action_12923868 ]
Lukasz Lenart commented on WW-3509:
-----------------------------------
Could you provide a test case or an example?
> JSONResult.setIncludeProperties() constructs incorrect patterns
> ---------------------------------------------------------------
>
> Key: WW-3509
> URL: https://issues.apache.org/jira/browse/WW-3509
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - JSON
> Affects Versions: 2.2.1
> Reporter: John Lindal
> Assignee: Lukasz Lenart
>
> // Add a pattern that does not have the indexed property
> // matching (ie. list\[\d+\] becomes list).
> if (patternPiece.endsWith("\\]")) {
> - this.includeProperties.add(Pattern.compile(patternExpr.substring(0, patternPiece
> + this.includeProperties.add(Pattern.compile(patternExpr.substring(0, patternExpr
> .lastIndexOf("\\["))));
>
> if (LOG.isDebugEnabled())
> LOG.debug("Adding include property expression: "
> - + patternExpr.substring(0, patternPiece.lastIndexOf("\\[")));
> + + patternExpr.substring(0, patternExpr.lastIndexOf("\\[")));
> }
>
> this.includeProperties.add(Pattern.compile(patternExpr));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.