Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.8
-
Component/s: ICE-Components
-
Labels:None
-
Environment:All
-
Workaround Exists:Yes
-
Workaround Description:Ensure SelectItems are constructed with non null values.
Description
If the SelectItem constructer's label is null (SelectItem(java.lang.Object value, java.lang.String label)), ICEfaces will fail to render the SelectItem and will throw an exception. Here is the code required to reproduce the issue:
public class BackingBean {
private String selectedItem;
private SelectItem[] items = new SelectItem[]{
new SelectItem("value1","label1"),
new SelectItem("value2","label2"),
new SelectItem("value3",null),
new SelectItem("value4","label4")
};
........
main.jspx
<ice:selectOneMenu id="SlctCompTyp"
partialSubmit="true">
<f:selectItems id="SlctcompTypeItms"
value="#{backingBean.items}"/>
</ice:selectOneMenu>
........
will cause the following exception to be thrown:
16:21:06,926 WARN [lifecycle] executePhase(RENDER_RESPONSE 6,com.icesoft.faces.context.BridgeFacesContext@1e212d0) threw exception
java.lang.NullPointerException
at java.io.Writer.write(Unknown Source)
at com.icesoft.faces.util.DOMUtils.printNode(DOMUtils.java:182)
at com.icesoft.faces.util.DOMUtils.printNode(DOMUtils.java:168)
at com.icesoft.faces.util.DOMUtils.printNode(DOMUtils.java:168)
.....
The workaround would of course be to have non null values. It would be nice to not throw such a nasty exception and instead handle it a bit more gracefully.
public class BackingBean {
private String selectedItem;
private SelectItem[] items = new SelectItem[]{
new SelectItem("value1","label1"),
new SelectItem("value2","label2"),
new SelectItem("value3",null),
new SelectItem("value4","label4")
};
........
main.jspx
<ice:selectOneMenu id="SlctCompTyp"
partialSubmit="true">
<f:selectItems id="SlctcompTypeItms"
value="#{backingBean.items}"/>
</ice:selectOneMenu>
........
will cause the following exception to be thrown:
16:21:06,926 WARN [lifecycle] executePhase(RENDER_RESPONSE 6,com.icesoft.faces.context.BridgeFacesContext@1e212d0) threw exception
java.lang.NullPointerException
at java.io.Writer.write(Unknown Source)
at com.icesoft.faces.util.DOMUtils.printNode(DOMUtils.java:182)
at com.icesoft.faces.util.DOMUtils.printNode(DOMUtils.java:168)
at com.icesoft.faces.util.DOMUtils.printNode(DOMUtils.java:168)
.....
The workaround would of course be to have non null values. It would be nice to not throw such a nasty exception and instead handle it a bit more gracefully.
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
Tyler Johnson
created issue -
Tyler Johnson
made changes -
Field | Original Value | New Value |
---|---|---|
Salesforce Case | [500700000080czp, 50070000007BmrT] |
Ken Fyten
made changes -
Fix Version/s | 1.8.2 [ 10190 ] | |
Assignee Priority | P3 | |
Assignee | Mark Collette [ mark.collette ] |
Ken Fyten
made changes -
Assignee | Mark Collette [ mark.collette ] | Yip Ng [ yip.ng ] |
yip.ng
made changes -
Attachment | ScreenHunter_04.jpg [ 11816 ] |
yip.ng
made changes -
Status | Open [ 1 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
yip.ng
made changes -
Attachment | ScreenHunter_05.jpg [ 11817 ] |
Ken Fyten
made changes -
Fix Version/s | 1.8.2-RC1 [ 10210 ] |
Ken Fyten
made changes -
Status | Resolved [ 5 ] | Closed [ 6 ] |
Assignee Priority | P3 |