[ 
https://issues.apache.org/jira/browse/MYFACES-1567?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Leonardo Uribe updated MYFACES-1567:
------------------------------------

    Resolution: Duplicate
        Status: Resolved  (was: Patch Available)

> "java.lang.IllegalArgumentException: Value is no String" due to NOTHING being 
> used
> ----------------------------------------------------------------------------------
>
>                 Key: MYFACES-1567
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1567
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 1.1.5
>            Reporter: Andrew Robinson
>            Assignee: Leonardo Uribe
>            Priority: Critical
>         Attachments: RendererUtils.patch
>
>
> "java.lang.IllegalArgumentException: Value is no String" error is caused in 
> all select one components in both CORE and TOMAHAWK due to the usage of 
> RendererUtils.NOTHING class.
> Instead of using "((EditableValueHolder) component).setSubmittedValue(null);" 
> in HtmlRendererUtils, the following code is used:
> ((EditableValueHolder) component).setSubmittedValue(RendererUtils.NOTHING);
> This NOTHING is not a valid submitted value for select one component and 
> causes errors.
> The stack trace is:
> ...does not have a Converter
>        at 
> org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:513)
>        at 
> org.apache.myfaces.shared_impl.renderkit.html.HtmlRadioRendererBase.encodeEnd(HtmlRadioRendererBase.java:95)
>        at 
> javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:539)
>        at 
> org.ajax4jsf.framework.renderer.RendererBase.renderChild(RendererBase.java:256)
>        at 
> org.ajax4jsf.framework.renderer.RendererBase.renderChildren(RendererBase.java:232)
>        at 
> org.ajax4jsf.framework.renderer.AjaxContainerRenderer.encodeChildren(AjaxContainerRenderer.java:100)
>        at 
> javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:527)
> ...
> During rendering of the component, the NOTHING is not null and not a string, 
> so therefore the error is thrown. This is a critical error as it breaks the 
> entire page and the user is left viewing an error page. 
> Proposed fix: remove the NOTHING variable from RendererUtils and use null 
> instead. The only code that actually cares about NOTHING is in 
> HtmlRendererUtils:
>             UISelectOne uiSelectOne = (UISelectOne) uiComponent;
>             Object lookup = uiSelectOne.getSubmittedValue();
>             if (lookup == null) {
>                 lookup = uiSelectOne.getValue();
>                 String lookupString = 
> RendererUtils.getConvertedStringValue(facesContext, uiComponent, converter, 
> lookup);
>                 lookupSet = Collections.singleton(lookupString);
>             }
>             else if 
> (org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.NOTHING.equals(lookup))
>  {
>                 lookupSet = Collections.EMPTY_SET;
>             }
> I don't see why it is done this way. It may be possible to use 
> isLocalValueSet instead (setLocalValueSet(true); setSubmittedValue(null);). 
> This way, it can be checked that a value was submitted, but the value was 
> null. If this proposed fix is not acceptible, 
> "org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:513)"
>  needs to be fixed to handle NOTHING values.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to