You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2015/05/28 11:41:22 UTC
svn commit: r1682187 - in
/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago:
internal/component/AbstractUISelectItem.java util/ComponentUtils.java
Author: deki
Date: Thu May 28 09:41:21 2015
New Revision: 1682187
URL: http://svn.apache.org/r1682187
Log:
TOBAGO-1453: fixed StackOverflowError
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectItem.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectItem.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectItem.java?rev=1682187&r1=1682186&r2=1682187&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectItem.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectItem.java Thu May 28 09:41:21 2015
@@ -24,6 +24,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.faces.component.UISelectItem;
+import javax.faces.component.UISelectMany;
import javax.faces.context.FacesContext;
public class AbstractUISelectItem extends UISelectItem {
@@ -47,7 +48,7 @@ public class AbstractUISelectItem extend
@Override
public Object getItemValue() {
- if (itemValueLiteral) {
+ if (itemValueLiteral && !(getParent() instanceof UISelectMany)) {
final Object converted = ComponentUtils.getConvertedValue(
FacesContext.getCurrentInstance(), getParent(), (String) super.getItemValue());
return converted;
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java?rev=1682187&r1=1682186&r2=1682187&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java Thu May 28 09:41:21 2015
@@ -19,6 +19,7 @@
package org.apache.myfaces.tobago.util;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.RendererTypes;
@@ -69,6 +70,7 @@ import javax.faces.render.Renderer;
import javax.faces.view.facelets.FaceletContext;
import javax.servlet.jsp.JspException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -1005,7 +1007,7 @@ public final class ComponentUtils {
if (renderer != null) {
if (component instanceof UISelectMany) {
final Object converted = renderer.getConvertedValue(facesContext, component, new String[]{stringValue});
- return converted instanceof List ? ((List) converted).get(0) : ((Object[]) converted)[0];
+ return converted instanceof Collection ? CollectionUtils.get(converted, 0) : ((Object[]) converted)[0];
} else {
return renderer.getConvertedValue(facesContext, component, stringValue);
}