You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Steve Wolke (JIRA)" <ji...@apache.org> on 2009/06/15 22:53:43 UTC
[jira] Created: (WW-3158) XSLT cannot render a collection that
contains a null value.
XSLT cannot render a collection that contains a null value.
-----------------------------------------------------------
Key: WW-3158
URL: https://issues.apache.org/struts/browse/WW-3158
Project: Struts 2
Issue Type: Bug
Components: Other
Affects Versions: 2.1.6
Environment: NA
Reporter: Steve Wolke
For example a action class
public class TestListNullEntry implements Action{
private List testList = new ArrayList();
public String execute() throws Exception {
testList.add("entry1");
testList.add(null);
testList.add("entry3");
return this.SUCCESS;
}
public List getTestList() {
return testList;
}
}
This action is unable to render a xslt result because of the null entry.
Code changes to fix this problem.
Index: C:/apache/struts/core/src/main/java/org/apache/struts2/views/xslt/AdapterFactory.java
===================================================================
--- AdapterFactory.java (revision 651946)
+++ AdapterFactory.java (working copy)
- public Node adaptNullValue(BeanAdapter parent, String propertyName) {
+ public Node adaptNullValue(AdapterNode parent, String propertyName) {
return new StringAdapter(this, parent, propertyName, "null");
}
Also changes needed in
Index: C:/apache/struts/core/src/main/java/org/apache/struts2/views/xslt/CollectionAdapter.java
===================================================================
--- CollectionAdapter.java (revision 651946)
+++ CollectionAdapter.java (working copy)
for (Object value : values) {
- Node childAdapter = getAdapterFactory().adaptNode(this, "item", value);
+ Node childAdapter;
+ if (value == null) {
+ childAdapter = getAdapterFactory().adaptNullValue(this, "item");
+ } else {
+ childAdapter = getAdapterFactory().adaptNode(this, "item", value);
+ }
if (childAdapter != null)
children.add(childAdapter);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WW-3158) XSLT cannot render a collection that
contains a null value.
Posted by "Steve Wolke (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46417#action_46417 ]
Steve Wolke commented on WW-3158:
---------------------------------
For the unit test you could just add a null value to the book list of the inner class MyAction in the current 'struts\core\src\test\java\org\apache\struts2\views\xslt\XSLTResultTest.java' file.
private class MyAction implements Action {
......
public List getBooks() {
List list = new ArrayList();
list.add(new Book("WebWork in Action", "Patrick and Jason"));
list.add(new Book("XWork not in Action", "Superman"));
+ list.add(null);
return list;
}
........
If you were to do this the current code would fail.
> XSLT cannot render a collection that contains a null value.
> -----------------------------------------------------------
>
> Key: WW-3158
> URL: https://issues.apache.org/struts/browse/WW-3158
> Project: Struts 2
> Issue Type: Bug
> Components: Other
> Affects Versions: 2.1.6
> Environment: NA
> Reporter: Steve Wolke
> Fix For: 2.1.8
>
>
> For example a action class
> public class TestListNullEntry implements Action{
> private List testList = new ArrayList();
>
> public String execute() throws Exception {
> testList.add("entry1");
> testList.add(null);
> testList.add("entry3");
> return this.SUCCESS;
> }
> public List getTestList() {
> return testList;
> }
> }
> This action is unable to render a xslt result because of the null entry.
> Code changes to fix this problem.
> Index: C:/apache/struts/core/src/main/java/org/apache/struts2/views/xslt/AdapterFactory.java
> ===================================================================
> --- AdapterFactory.java (revision 651946)
> +++ AdapterFactory.java (working copy)
> - public Node adaptNullValue(BeanAdapter parent, String propertyName) {
> + public Node adaptNullValue(AdapterNode parent, String propertyName) {
> return new StringAdapter(this, parent, propertyName, "null");
> }
> Also changes needed in
> Index: C:/apache/struts/core/src/main/java/org/apache/struts2/views/xslt/CollectionAdapter.java
> ===================================================================
> --- CollectionAdapter.java (revision 651946)
> +++ CollectionAdapter.java (working copy)
> for (Object value : values) {
> - Node childAdapter = getAdapterFactory().adaptNode(this, "item", value);
> + Node childAdapter;
> + if (value == null) {
> + childAdapter = getAdapterFactory().adaptNullValue(this, "item");
> + } else {
> + childAdapter = getAdapterFactory().adaptNode(this, "item", value);
> + }
> if (childAdapter != null)
> children.add(childAdapter);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (WW-3158) XSLT cannot render a collection that
contains a null value.
Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Musachy Barroso resolved WW-3158.
---------------------------------
Resolution: Fixed
fixed in trunk. thanks for the patch!
> XSLT cannot render a collection that contains a null value.
> -----------------------------------------------------------
>
> Key: WW-3158
> URL: https://issues.apache.org/struts/browse/WW-3158
> Project: Struts 2
> Issue Type: Bug
> Components: Other
> Affects Versions: 2.1.6
> Environment: NA
> Reporter: Steve Wolke
> Fix For: 2.1.8
>
>
> For example a action class
> public class TestListNullEntry implements Action{
> private List testList = new ArrayList();
>
> public String execute() throws Exception {
> testList.add("entry1");
> testList.add(null);
> testList.add("entry3");
> return this.SUCCESS;
> }
> public List getTestList() {
> return testList;
> }
> }
> This action is unable to render a xslt result because of the null entry.
> Code changes to fix this problem.
> Index: C:/apache/struts/core/src/main/java/org/apache/struts2/views/xslt/AdapterFactory.java
> ===================================================================
> --- AdapterFactory.java (revision 651946)
> +++ AdapterFactory.java (working copy)
> - public Node adaptNullValue(BeanAdapter parent, String propertyName) {
> + public Node adaptNullValue(AdapterNode parent, String propertyName) {
> return new StringAdapter(this, parent, propertyName, "null");
> }
> Also changes needed in
> Index: C:/apache/struts/core/src/main/java/org/apache/struts2/views/xslt/CollectionAdapter.java
> ===================================================================
> --- CollectionAdapter.java (revision 651946)
> +++ CollectionAdapter.java (working copy)
> for (Object value : values) {
> - Node childAdapter = getAdapterFactory().adaptNode(this, "item", value);
> + Node childAdapter;
> + if (value == null) {
> + childAdapter = getAdapterFactory().adaptNullValue(this, "item");
> + } else {
> + childAdapter = getAdapterFactory().adaptNode(this, "item", value);
> + }
> if (childAdapter != null)
> children.add(childAdapter);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WW-3158) XSLT cannot render a collection that
contains a null value.
Posted by "Wes Wannemacher (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Wes Wannemacher updated WW-3158:
--------------------------------
Fix Version/s: 2.1.8
if you can throw together a unit test to go along with this, we'll include it in the next release.
> XSLT cannot render a collection that contains a null value.
> -----------------------------------------------------------
>
> Key: WW-3158
> URL: https://issues.apache.org/struts/browse/WW-3158
> Project: Struts 2
> Issue Type: Bug
> Components: Other
> Affects Versions: 2.1.6
> Environment: NA
> Reporter: Steve Wolke
> Fix For: 2.1.8
>
>
> For example a action class
> public class TestListNullEntry implements Action{
> private List testList = new ArrayList();
>
> public String execute() throws Exception {
> testList.add("entry1");
> testList.add(null);
> testList.add("entry3");
> return this.SUCCESS;
> }
> public List getTestList() {
> return testList;
> }
> }
> This action is unable to render a xslt result because of the null entry.
> Code changes to fix this problem.
> Index: C:/apache/struts/core/src/main/java/org/apache/struts2/views/xslt/AdapterFactory.java
> ===================================================================
> --- AdapterFactory.java (revision 651946)
> +++ AdapterFactory.java (working copy)
> - public Node adaptNullValue(BeanAdapter parent, String propertyName) {
> + public Node adaptNullValue(AdapterNode parent, String propertyName) {
> return new StringAdapter(this, parent, propertyName, "null");
> }
> Also changes needed in
> Index: C:/apache/struts/core/src/main/java/org/apache/struts2/views/xslt/CollectionAdapter.java
> ===================================================================
> --- CollectionAdapter.java (revision 651946)
> +++ CollectionAdapter.java (working copy)
> for (Object value : values) {
> - Node childAdapter = getAdapterFactory().adaptNode(this, "item", value);
> + Node childAdapter;
> + if (value == null) {
> + childAdapter = getAdapterFactory().adaptNullValue(this, "item");
> + } else {
> + childAdapter = getAdapterFactory().adaptNode(this, "item", value);
> + }
> if (childAdapter != null)
> children.add(childAdapter);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (WW-3158) XSLT cannot render a
collection that contains a null value.
Posted by "Steve Wolke (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46417#action_46417 ]
Steve Wolke edited comment on WW-3158 at 8/5/09 12:28 PM:
----------------------------------------------------------
For the unit test you could just add a null value to the book list of the inner class MyAction in the current 'struts\core\src\test\java\org\apache\struts2\views\xslt\XSLTResultTest.java' file.
private class MyAction implements Action {
......
public List getBooks() {
List list = new ArrayList();
list.add(new Book("WebWork in Action", "Patrick and Jason"));
+ list.add(null);
list.add(new Book("XWork not in Action", "Superman"));
return list;
}
........
If you were to do this the current code would fail.
was (Author: smwolke):
For the unit test you could just add a null value to the book list of the inner class MyAction in the current 'struts\core\src\test\java\org\apache\struts2\views\xslt\XSLTResultTest.java' file.
private class MyAction implements Action {
......
public List getBooks() {
List list = new ArrayList();
list.add(new Book("WebWork in Action", "Patrick and Jason"));
list.add(new Book("XWork not in Action", "Superman"));
+ list.add(null);
return list;
}
........
If you were to do this the current code would fail.
> XSLT cannot render a collection that contains a null value.
> -----------------------------------------------------------
>
> Key: WW-3158
> URL: https://issues.apache.org/struts/browse/WW-3158
> Project: Struts 2
> Issue Type: Bug
> Components: Other
> Affects Versions: 2.1.6
> Environment: NA
> Reporter: Steve Wolke
> Fix For: 2.1.8
>
>
> For example a action class
> public class TestListNullEntry implements Action{
> private List testList = new ArrayList();
>
> public String execute() throws Exception {
> testList.add("entry1");
> testList.add(null);
> testList.add("entry3");
> return this.SUCCESS;
> }
> public List getTestList() {
> return testList;
> }
> }
> This action is unable to render a xslt result because of the null entry.
> Code changes to fix this problem.
> Index: C:/apache/struts/core/src/main/java/org/apache/struts2/views/xslt/AdapterFactory.java
> ===================================================================
> --- AdapterFactory.java (revision 651946)
> +++ AdapterFactory.java (working copy)
> - public Node adaptNullValue(BeanAdapter parent, String propertyName) {
> + public Node adaptNullValue(AdapterNode parent, String propertyName) {
> return new StringAdapter(this, parent, propertyName, "null");
> }
> Also changes needed in
> Index: C:/apache/struts/core/src/main/java/org/apache/struts2/views/xslt/CollectionAdapter.java
> ===================================================================
> --- CollectionAdapter.java (revision 651946)
> +++ CollectionAdapter.java (working copy)
> for (Object value : values) {
> - Node childAdapter = getAdapterFactory().adaptNode(this, "item", value);
> + Node childAdapter;
> + if (value == null) {
> + childAdapter = getAdapterFactory().adaptNullValue(this, "item");
> + } else {
> + childAdapter = getAdapterFactory().adaptNode(this, "item", value);
> + }
> if (childAdapter != null)
> children.add(childAdapter);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.