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:11:46 UTC

svn commit: r1824490 - in /myfaces/core/trunk: 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:11:46 2018
New Revision: 1824490

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

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

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/_SelectItemsIterator.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/_SelectItemsIterator.java?rev=1824490&r1=1824489&r2=1824490&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/_SelectItemsIterator.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/_SelectItemsIterator.java Fri Feb 16 14:11:46 2018
@@ -120,7 +120,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();
                     }
@@ -255,7 +255,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/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/SelectItemsIterator.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/SelectItemsIterator.java?rev=1824490&r1=1824489&r2=1824490&view=diff
==============================================================================
--- myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/SelectItemsIterator.java (original)
+++ myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/SelectItemsIterator.java Fri Feb 16 14:11:46 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();
                 }