Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-1567

"java.lang.IllegalArgumentException: Value is no String" due to NOTHING being used



    • Bug
    • Status: Closed
    • Critical
    • Resolution: Duplicate
    • 1.1.5
    • None
    • General
    • None


      "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.


        1. RendererUtils.patch
          0.8 kB
          Christopher Pierce

        Issue Links



              lu4242 Leonardo Uribe
              arobinson74 Andrew Robinson
              1 Vote for this issue
              0 Start watching this issue