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:30:39 UTC
svn commit: r1583275 - in /myfaces/tobago/branches/tobago-1.5.x:
tobago-core/src/main/java/org/apache/myfaces/tobago/util/
tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/
tobago-example/tobago-examp...
Author: lofwyr
Date: Mon Mar 31 09:30:39 2014
New Revision: 1583275
URL: http://svn.apache.org/r1583275
Log:
TOBAGO-1381: Radio- and Checkbox-Renderer may produce an NullPointerException
Modified:
myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java
myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java
myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java
myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java
myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java
myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java?rev=1583275&r1=1583274&r2=1583275&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java Mon Mar 31 09:30:39 2014
@@ -20,6 +20,7 @@
package org.apache.myfaces.tobago.util;
import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.Facets;
@@ -670,7 +671,7 @@ public class ComponentUtils {
public static boolean hasSelectedValue(List<SelectItem> items, Object value) {
for (SelectItem item : items) {
- if (item.getValue().equals(value)) {
+ if (ObjectUtils.equals(item.getValue(), value)) {
return true;
}
}
Modified: myfaces/tobago/branches/tobago-1.5.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-1.5.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java?rev=1583275&r1=1583274&r2=1583275&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java Mon Mar 31 09:30:39 2014
@@ -24,12 +24,13 @@ package org.apache.myfaces.tobago.exampl
* $Id$
*/
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.commons.lang.ObjectUtils;
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.util.VariableResolverUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.faces.application.Application;
import javax.faces.context.FacesContext;
@@ -178,7 +179,7 @@ public class ClientConfigController {
public String getLocalizedTheme() {
for (int i = 0; i < themeItems.length; i++) {
SelectItem themeItem = themeItems[i];
- if (themeItem.getValue().equals(theme)) {
+ if (ObjectUtils.equals(themeItem.getValue(), theme)) {
return themeItem.getLabel();
}
}
Modified: myfaces/tobago/branches/tobago-1.5.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-1.5.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java?rev=1583275&r1=1583274&r2=1583275&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java Mon Mar 31 09:30:39 2014
@@ -19,6 +19,7 @@
package org.apache.myfaces.tobago.example.test;
+import org.apache.commons.lang.ObjectUtils;
import org.apache.myfaces.tobago.config.TobagoConfig;
import org.apache.myfaces.tobago.context.ClientProperties;
import org.apache.myfaces.tobago.context.Theme;
@@ -144,7 +145,7 @@ public class ClientConfigController {
public String getLocalizedTheme() {
for (int i = 0; i < themeItems.length; i++) {
SelectItem themeItem = themeItems[i];
- if (themeItem.getValue().equals(theme)) {
+ if (ObjectUtils.equals(themeItem.getValue(), theme)) {
return themeItem.getLabel();
}
}
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java?rev=1583275&r1=1583274&r2=1583275&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java Mon Mar 31 09:30:39 2014
@@ -19,6 +19,7 @@
package org.apache.myfaces.tobago.renderkit.html.scarborough.standard.tag;
+import org.apache.commons.lang.ObjectUtils;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.RendererTypes;
@@ -89,7 +90,7 @@ public class MenuCommandRenderer extends
List<SelectItem> items = RenderUtils.getSelectItems(radio);
String hiddenId = radio.getClientId(facesContext);
for (SelectItem item : items) {
- boolean checked = item.getValue().equals(radio.getValue());
+ boolean checked = ObjectUtils.equals(item.getValue(), radio.getValue());
String image = checked ? "image/MenuRadioChecked.gif" : null;
final String labelText = item.getLabel();
label.reset();
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java?rev=1583275&r1=1583274&r2=1583275&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java Mon Mar 31 09:30:39 2014
@@ -77,8 +77,9 @@ public class SelectManyCheckboxRenderer
Object[] values = select.getSelectedValues();
List<String> clientIds = new ArrayList<String>();
+ int i = 0;
for (SelectItem item : items) {
- String itemId = id + NamingContainer.SEPARATOR_CHAR + NamingContainer.SEPARATOR_CHAR + item.getValue().toString();
+ String itemId = id + NamingContainer.SEPARATOR_CHAR + NamingContainer.SEPARATOR_CHAR + i++;
clientIds.add(itemId);
writer.startElement(HtmlElements.LI, select);
writer.startElement(HtmlElements.INPUT, select);
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java?rev=1583275&r1=1583274&r2=1583275&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java Mon Mar 31 09:30:39 2014
@@ -19,6 +19,7 @@
package org.apache.myfaces.tobago.renderkit.html.scarborough.standard.tag;
+import org.apache.commons.lang.ObjectUtils;
import org.apache.myfaces.tobago.component.UISelectOneRadio;
import org.apache.myfaces.tobago.config.Configurable;
import org.apache.myfaces.tobago.context.Markup;
@@ -81,13 +82,14 @@ public class SelectOneRadioRenderer exte
Object value = select.getValue();
List<String> clientIds = new ArrayList<String>();
+ int i = 0;
for (SelectItem item : items) {
- String itemId = id + NamingContainer.SEPARATOR_CHAR + NamingContainer.SEPARATOR_CHAR + item.getValue().toString();
+ String itemId = id + NamingContainer.SEPARATOR_CHAR + NamingContainer.SEPARATOR_CHAR + i++;
clientIds.add(itemId);
writer.startElement(HtmlElements.LI, select);
writer.startElement(HtmlElements.INPUT, select);
writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.RADIO, false);
- boolean checked = item.getValue().equals(value);
+ boolean checked = ObjectUtils.equals(item.getValue(), value);
writer.writeAttribute(HtmlAttributes.CHECKED, checked);
writer.writeNameAttribute(id);
writer.writeIdAttribute(itemId);
Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java?rev=1583275&r1=1583274&r2=1583275&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java Mon Mar 31 09:30:39 2014
@@ -19,6 +19,7 @@
package org.apache.myfaces.tobago.renderkit.html.scarborough.standard.tag;
+import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.Facets;
@@ -171,7 +172,7 @@ public abstract class ToolBarRendererBas
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;