Details
-
Type:
Improvement
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.7DR#2
-
Fix Version/s: 1.7
-
Component/s: None
-
Labels:None
-
Environment:Apach 6.0.14, ice 1.7DR2, jsf 1.2.04
Description
When users got slectitems with null like:
<f:selectItem itemValue="" itemLabel="op default" />
<f:selectItem itemValue="0" itemLabel="op1" />
<f:selectItem itemValue="1" itemLabel="op2" />
may see this error:
java.lang.NumberFormatException: For input string: ""
java.lang.NumberFormatException.forInputString(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
java.lang.Short.parseShort(Unknown Source)
java.lang.Short.valueOf(Unknown Source)
java.lang.Short.valueOf(Unknown Source)
com.icesoft.faces.renderkit.dom_html_basic.MenuRenderer.isConversionMatched(MenuRenderer.java:663)
com.icesoft.faces.renderkit.dom_html_basic.MenuRenderer.isSelected(MenuRenderer.java:469)
With class version of this list like <f:selectItems> these errors are not occurs.
I think that this patch should be added to file
com.icesoft.faces.renderkit.dom_html_basic.MenuRenderer.java
Around line 649-653
private boolean isConversionMatched(String sentinel, Object selectedValue){
boolean match = false;
> if (sentinel!=null && sentinel.length()==0 && selectedValue==null){
> match = true;
> } else
if (selectedValue instanceof Long){
if (selectedValue.equals(Long.valueOf(sentinel))) {
<f:selectItem itemValue="" itemLabel="op default" />
<f:selectItem itemValue="0" itemLabel="op1" />
<f:selectItem itemValue="1" itemLabel="op2" />
may see this error:
java.lang.NumberFormatException: For input string: ""
java.lang.NumberFormatException.forInputString(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
java.lang.Short.parseShort(Unknown Source)
java.lang.Short.valueOf(Unknown Source)
java.lang.Short.valueOf(Unknown Source)
com.icesoft.faces.renderkit.dom_html_basic.MenuRenderer.isConversionMatched(MenuRenderer.java:663)
com.icesoft.faces.renderkit.dom_html_basic.MenuRenderer.isSelected(MenuRenderer.java:469)
With class version of this list like <f:selectItems> these errors are not occurs.
I think that this patch should be added to file
com.icesoft.faces.renderkit.dom_html_basic.MenuRenderer.java
Around line 649-653
private boolean isConversionMatched(String sentinel, Object selectedValue){
boolean match = false;
> if (sentinel!=null && sentinel.length()==0 && selectedValue==null){
> match = true;
> } else
if (selectedValue instanceof Long){
if (selectedValue.equals(Long.valueOf(sentinel))) {
I checked the EL type conversion rules, and your patch suggestion is consistent with that.
Subversion 16101
icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\MenuRenderer.java