You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2018/02/16 14:15:28 UTC

svn commit: r1824492 - in /myfaces/core/branches/2.3.x: api/src/main/java/javax/faces/component/_SelectItemsIterator.java shared-public/src/main/java/org/apache/myfaces/shared/util/SelectItemsIterator.java

Author: tandraschko
Date: Fri Feb 16 14:15:27 2018
New Revision: 1824492

URL: http://svn.apache.org/viewvc?rev=1824492&view=rev
Log:
MYFACES-4199 NPE with <f:selectItem>

Modified:
    myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/_SelectItemsIterator.java
    myfaces/core/branches/2.3.x/shared-public/src/main/java/org/apache/myfaces/shared/util/SelectItemsIterator.java

Modified: myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/_SelectItemsIterator.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/_SelectItemsIterator.java?rev=1824492&r1=1824491&r2=1824492&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/_SelectItemsIterator.java (original)
+++ myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/_SelectItemsIterator.java Fri Feb 16 14:15:27 2018
@@ -121,7 +121,7 @@ class _SelectItemsIterator implements It
                     boolean disabled = uiSelectItem.isItemDisabled();
                     boolean escape = uiSelectItem.isItemEscaped();
                     boolean noSelectionOption = uiSelectItem.isNoSelectionOption();
-                    if (label == null)
+                    if (label == null && itemValue != null)
                     {
                         label = itemValue.toString();
                     }
@@ -257,7 +257,7 @@ class _SelectItemsIterator implements It
                 // Spec: When iterating over the select items, toString() 
                 // must be called on the string rendered attribute values
                 Object itemLabel = attributeMap.get(ITEM_LABEL_ATTR);
-                if (itemLabel == null)
+                if (itemLabel == null && itemValue != null)
                 {
                     itemLabel = itemValue.toString();
                 }

Modified: myfaces/core/branches/2.3.x/shared-public/src/main/java/org/apache/myfaces/shared/util/SelectItemsIterator.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/shared-public/src/main/java/org/apache/myfaces/shared/util/SelectItemsIterator.java?rev=1824492&r1=1824491&r2=1824492&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/shared-public/src/main/java/org/apache/myfaces/shared/util/SelectItemsIterator.java (original)
+++ myfaces/core/branches/2.3.x/shared-public/src/main/java/org/apache/myfaces/shared/util/SelectItemsIterator.java Fri Feb 16 14:15:27 2018
@@ -125,7 +125,7 @@ public class SelectItemsIterator impleme
                     boolean disabled = uiSelectItem.isItemDisabled();
                     boolean escape = uiSelectItem.isItemEscaped();
                     boolean noSelectionOption = uiSelectItem.isNoSelectionOption();
-                    if (label == null)
+                    if (label == null && itemValue != null)
                     {
                         label = itemValue.toString();
                     }
@@ -264,7 +264,7 @@ public class SelectItemsIterator impleme
                 // Spec: When iterating over the select items, toString() 
                 // must be called on the string rendered attribute values
                 Object itemLabel = attributeMap.get(ITEM_LABEL_PROP);
-                if (itemLabel == null)
+                if (itemLabel == null && itemValue != null)
                 {
                     itemLabel = itemValue.toString();
                 }