You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2014/03/31 11:32:01 UTC

svn commit: r1583276 - in /myfaces/tobago/branches/tobago-3.0.x: tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/ tobago-core/src/main/java/org/apache/myfaces/tobago/util/ tobago-example/tobago-example-demo/src/main/java/org/apache/my...

Author: lofwyr
Date: Mon Mar 31 09:32:01 2014
New Revision: 1583276

URL: http://svn.apache.org/r1583276
Log:
TOBAGO-1381: Radio- and Checkbox-Renderer may produce an NullPointerException

Added:
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/ObjectUtils.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/in/id-and-fieldId.js
Modified:
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/in/id-and-fieldId.xhtml
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneRadioRenderer.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java

Added: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/ObjectUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/ObjectUtils.java?rev=1583276&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/ObjectUtils.java (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/ObjectUtils.java Mon Mar 31 09:32:01 2014
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.tobago.internal.util;
+
+public class ObjectUtils {
+
+  private ObjectUtils() {
+    // utils class
+  }
+
+  @SuppressWarnings("ObjectEquality")
+  public static boolean equals(Object o1, Object o2) {
+    return o1 == o2 || o1 != null && o1.equals(o2);
+  }
+}

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java?rev=1583276&r1=1583275&r2=1583276&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java Mon Mar 31 09:32:01 2014
@@ -33,6 +33,7 @@ import org.apache.myfaces.tobago.interna
 import org.apache.myfaces.tobago.internal.util.ArrayUtils;
 import org.apache.myfaces.tobago.internal.util.Deprecation;
 import org.apache.myfaces.tobago.internal.util.FindComponentUtils;
+import org.apache.myfaces.tobago.internal.util.ObjectUtils;
 import org.apache.myfaces.tobago.internal.util.StringUtils;
 import org.apache.myfaces.tobago.renderkit.RendererBase;
 import org.slf4j.Logger;
@@ -675,7 +676,7 @@ public final class ComponentUtils {
   @Deprecated
   public static boolean hasSelectedValue(final List<SelectItem> items, final Object value) {
     for (final SelectItem item : items) {
-      if (item.getValue().equals(value)) {
+      if (ObjectUtils.equals(item.getValue(), value)) {
         return true;
       }
     }

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java?rev=1583276&r1=1583275&r2=1583276&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java Mon Mar 31 09:32:01 2014
@@ -19,6 +19,7 @@
 
 package org.apache.myfaces.tobago.example.demo.clientConfig;
 
+import org.apache.myfaces.tobago.internal.util.ObjectUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.myfaces.tobago.config.TobagoConfig;
@@ -146,7 +147,7 @@ public class ClientConfigController {
   public String getLocalizedTheme() {
     for (int i = 0; i < themeItems.length; i++) {
       final SelectItem themeItem = themeItems[i];
-      if (themeItem.getValue().equals(theme)) {
+      if (ObjectUtils.equals(themeItem.getValue(), theme)) {
         return themeItem.getLabel();
       }
     }

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java?rev=1583276&r1=1583275&r2=1583276&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java Mon Mar 31 09:32:01 2014
@@ -22,6 +22,7 @@ package org.apache.myfaces.tobago.exampl
 import org.apache.myfaces.tobago.config.TobagoConfig;
 import org.apache.myfaces.tobago.context.ClientProperties;
 import org.apache.myfaces.tobago.context.Theme;
+import org.apache.myfaces.tobago.internal.util.ObjectUtils;
 import org.apache.myfaces.tobago.util.VariableResolverUtils;
 
 import javax.faces.application.Application;
@@ -120,7 +121,7 @@ public class ClientConfigController {
   public String getLocalizedTheme() {
     for (int i = 0; i < themeItems.length; i++) {
       final SelectItem themeItem = themeItems[i];
-      if (themeItem.getValue().equals(theme)) {
+      if (ObjectUtils.equals(themeItem.getValue(), theme)) {
         return themeItem.getLabel();
       }
     }

Added: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/in/id-and-fieldId.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/in/id-and-fieldId.js?rev=1583276&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/in/id-and-fieldId.js (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/in/id-and-fieldId.js Mon Mar 31 09:32:01 2014
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+jQuery(document).ready(function() {
+
+  fillIdDisplay("0", ".tobago-in");
+  fillIdDisplay("1", ".tobago-in");
+  fillIdDisplay("2", ".tobago-in");
+  fillIdDisplay("3", ".tobago-in");
+  fillIdDisplay("4", ".tobago-in");
+  fillIdDisplay("5", ".tobago-date");
+  fillIdDisplay("6", ".tobago-time");
+  fillIdDisplay("7", ".tobago-file");
+  fillIdDisplay("8", ".tobago-textarea");
+  fillIdDisplay("9", ".tobago-selectBooleanCheckbox");
+  fillIdDisplay("10", ".tobago-selectManyCheckbox");
+  fillIdDisplay("11", ".tobago-selectManyListbox");
+  fillIdDisplay("12", ".tobago-selectOneChoice");
+  fillIdDisplay("13", ".tobago-selectOneListbox");
+  fillIdDisplay("14", ".tobago-selectOneRadio");
+
+  test("page:panel2", "page:alpha");
+  test("page:field3", "page:beta");
+  test("page:panel4", "page:gamma");
+  test("page:field4", "page:delta");
+  test("page:panel5", "page:datePanel");
+  test("page:field5", "page:dateField");
+  test("page:panel6", "page:timePanel");
+  test("page:field6", "page:timeField");
+  test("page:panel7", "page:filePanel");
+  test("page:field7", "page:fileField");
+  test("page:panel8", "page:textareaPanel");
+  test("page:field8", "page:textareaField");
+  test("page:panel9", "page:selectBooleanCheckboxPanel");
+  test("page:field9", "page:selectBooleanCheckboxField");
+  test("page:panel10", "page:selectManyCheckboxPanel");
+  test("page:field10", "page:selectManyCheckboxField");
+  test("page:panel11", "page:selectManyListboxPanel");
+  test("page:field11", "page:selectManyListboxField");
+  test("page:panel12", "page:selectOneChoicePanel");
+  test("page:field12", "page:selectOneChoiceField");
+  test("page:panel13", "page:selectOneListboxPanel");
+  test("page:field13", "page:selectOneListboxField");
+  test("page:panel14", "page:selectOneRadioPanel");
+  test("page:field14", "page:selectOneRadioField");
+
+});
+
+function fillIdDisplay(i, fieldClass) {
+  var panelIn = jQuery(Tobago.Utils.escapeClientId("page:panel" + i));
+  var labelIn = jQuery(Tobago.Utils.escapeClientId("page:label" + i));
+  var fieldIn = jQuery(Tobago.Utils.escapeClientId("page:field" + i));
+
+  var panel = panelIn.prev();
+  var label = panel.children(".tobago-label");
+  var field = panel.children(fieldClass);
+
+  panelIn.val(panel.attr("id"));
+  labelIn.val(label.attr("id"));
+  fieldIn.val(field.attr("id"));
+}
+
+function test(testId, expected) {
+  var element = jQuery(Tobago.Utils.escapeClientId(testId));
+  if (element.val() != expected) {
+    element.addClass("tobago-in-markup-error");
+    element.attr("title", "expected: '" + expected + "'");
+  }
+}

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/in/id-and-fieldId.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/in/id-and-fieldId.xhtml?rev=1583276&r1=1583275&r2=1583276&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/in/id-and-fieldId.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/in/id-and-fieldId.xhtml Mon Mar 31 09:32:01 2014
@@ -128,75 +128,7 @@
     <tc:cell/>
     <tc:button label="Reload"/>
 
-    <tc:script>
-      jQuery(document).ready(function() {
-
-        fillIdDisplay("0", ".tobago-in");
-        fillIdDisplay("1", ".tobago-in");
-        fillIdDisplay("2", ".tobago-in");
-        fillIdDisplay("3", ".tobago-in");
-        fillIdDisplay("4", ".tobago-in");
-        fillIdDisplay("5", ".tobago-date");
-        fillIdDisplay("6", ".tobago-time");
-        fillIdDisplay("7", ".tobago-file");
-        fillIdDisplay("8", ".tobago-textarea");
-        fillIdDisplay("9", ".tobago-selectBooleanCheckbox");
-        fillIdDisplay("10", ".tobago-selectManyCheckbox");
-        fillIdDisplay("11", ".tobago-selectManyListbox");
-        fillIdDisplay("12", ".tobago-selectOneChoice");
-        fillIdDisplay("13", ".tobago-selectOneListbox");
-        fillIdDisplay("14", ".tobago-selectOneRadio");
-
-        test("page:panel2", "page:alpha");
-        test("page:field3", "page:beta");
-        test("page:panel4", "page:gamma");
-        test("page:field4", "page:delta");
-        test("page:panel5", "page:datePanel");
-        test("page:field5", "page:dateField");
-        test("page:panel6", "page:timePanel");
-        test("page:field6", "page:timeField");
-        test("page:panel7", "page:filePanel");
-        test("page:field7", "page:fileField");
-        test("page:panel8", "page:textareaPanel");
-        test("page:field8", "page:textareaField");
-        test("page:panel9", "page:selectBooleanCheckboxPanel");
-        test("page:field9", "page:selectBooleanCheckboxField");
-        test("page:panel10", "page:selectManyCheckboxPanel");
-        test("page:field10", "page:selectManyCheckboxField");
-        test("page:panel11", "page:selectManyListboxPanel");
-        test("page:field11", "page:selectManyListboxField");
-        test("page:panel12", "page:selectOneChoicePanel");
-        test("page:field12", "page:selectOneChoiceField");
-        test("page:panel13", "page:selectOneListboxPanel");
-        test("page:field13", "page:selectOneListboxField");
-        test("page:panel14", "page:selectOneRadioPanel");
-        test("page:field14", "page:selectOneRadioField");
-
-      });
-
-      function fillIdDisplay(i, fieldClass) {
-        var panelIn = jQuery(Tobago.Utils.escapeClientId("page:panel" + i));
-        var labelIn = jQuery(Tobago.Utils.escapeClientId("page:label" + i));
-        var fieldIn = jQuery(Tobago.Utils.escapeClientId("page:field" + i));
-
-        var panel = panelIn.prev();
-        var label = panel.children(".tobago-label");
-        var field = panel.children(fieldClass);
-
-        panelIn.val(panel.attr("id"));
-        labelIn.val(label.attr("id"));
-        fieldIn.val(field.attr("id"));
-      }
-
-      function test(testId, expected) {
-        var element = jQuery(Tobago.Utils.escapeClientId(testId));
-        if (element.val() != expected) {
-          element.addClass("tobago-in-markup-error");
-          element.attr("title", "expected: '" + expected + "'");
-        }
-      }
-
-    </tc:script>
+    <tc:script file="test/in/id-and-fieldId.js"/>
 
   </tc:page>
 </f:view>

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java?rev=1583276&r1=1583275&r2=1583276&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java Mon Mar 31 09:32:01 2014
@@ -28,6 +28,7 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.context.Markup;
 import org.apache.myfaces.tobago.context.ResourceManagerUtils;
 import org.apache.myfaces.tobago.internal.util.AccessKeyMap;
+import org.apache.myfaces.tobago.internal.util.ObjectUtils;
 import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.renderkit.CommandRendererBase;
 import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
@@ -88,7 +89,7 @@ public class MenuCommandRenderer extends
       final UISelectOne radio = (UISelectOne) command.getFacet(Facets.RADIO);
       final String hiddenId = radio.getClientId(facesContext);
       for (final SelectItem item : SelectItemUtils.getItemIterator(facesContext, radio)) {
-        final boolean checked = item.getValue().equals(radio.getValue());
+        final boolean checked = ObjectUtils.equals(item.getValue(), radio.getValue());
         final String image = checked ? "image/MenuRadioChecked.gif" : null;
         final String labelText = item.getLabel();
         label.reset();

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java?rev=1583276&r1=1583275&r2=1583276&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java Mon Mar 31 09:32:01 2014
@@ -74,8 +74,9 @@ public class SelectManyCheckboxRenderer 
     }
     boolean first = true;
     final Object[] values = select.getSelectedValues();
+    int i = 0;
     for (final SelectItem item : SelectItemUtils.getItemIterator(facesContext, select)) {
-      final String itemId = id + ComponentUtils.SUB_SEPARATOR + item.getValue().toString();
+      final String itemId = id + ComponentUtils.SUB_SEPARATOR + i++;
       writer.startElement(HtmlElements.LI, select);
       writer.startElement(HtmlElements.INPUT, select);
       writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.CHECKBOX, false);

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneRadioRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneRadioRenderer.java?rev=1583276&r1=1583275&r2=1583276&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneRadioRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneRadioRenderer.java Mon Mar 31 09:32:01 2014
@@ -23,6 +23,7 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.config.Configurable;
 import org.apache.myfaces.tobago.context.Markup;
 import org.apache.myfaces.tobago.context.ResourceManagerUtils;
+import org.apache.myfaces.tobago.internal.util.ObjectUtils;
 import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.renderkit.SelectOneRendererBase;
 import org.apache.myfaces.tobago.renderkit.css.Classes;
@@ -76,12 +77,13 @@ public class SelectOneRadioRenderer exte
     }
     boolean first = true;
     final Object value = select.getValue();
+    int i = 0;
     for (final SelectItem item : items) {
-      final String itemId = id + ComponentUtils.SUB_SEPARATOR + item.getValue().toString();
+      final String itemId = id + ComponentUtils.SUB_SEPARATOR + i++;
       writer.startElement(HtmlElements.LI, select);
       writer.startElement(HtmlElements.INPUT, select);
       writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.RADIO, false);
-      final boolean checked = item.getValue().equals(value);
+      final boolean checked = ObjectUtils.equals(item.getValue(), value);
       writer.writeAttribute(HtmlAttributes.CHECKED, checked);
       writer.writeNameAttribute(id);
       writer.writeIdAttribute(itemId);

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java?rev=1583276&r1=1583275&r2=1583276&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java Mon Mar 31 09:32:01 2014
@@ -33,6 +33,7 @@ import org.apache.myfaces.tobago.context
 import org.apache.myfaces.tobago.internal.component.AbstractUICommandBase;
 import org.apache.myfaces.tobago.internal.component.AbstractUIMenu;
 import org.apache.myfaces.tobago.internal.context.ResourceManagerFactory;
+import org.apache.myfaces.tobago.internal.util.ObjectUtils;
 import org.apache.myfaces.tobago.internal.util.StringUtils;
 import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
@@ -164,7 +165,7 @@ public abstract class ToolBarRendererBas
 
         final String formattedValue = RenderUtils.getFormattedValue(facesContext, radio, item.getValue());
         final boolean checked;
-        if (item.getValue().equals(value) || markFirst) {
+        if (ObjectUtils.equals(item.getValue(), value) || markFirst) {
           checked = true;
           markFirst = false;
           currentValue = formattedValue;
@@ -607,7 +608,7 @@ public abstract class ToolBarRendererBas
 
   private boolean hasSelectedValue(final Iterable<SelectItem> items, final Object value) {
     for (final SelectItem item : items) {
-      if (item.getValue().equals(value)) {
+      if (ObjectUtils.equals(item.getValue(), value)) {
         return true;
       }
     }