Detection of empty selection in UISelectOne through RenderUtils.NOTHING is faulty ---------------------------------------------------------------------------------
Key: MYFACES-2099 URL: https://issues.apache.org/jira/browse/MYFACES-2099 Project: MyFaces Core Issue Type: Bug Affects Versions: 1.1.7-SNAPSHOT Environment: All Reporter: Andreas Watermeyer RenderUtils.getConvertedUIOutputValue() throws an IllegalArgumentException because it does not recognize RenderUtils.NOTHING (see stacktrace below). Problem is the following code, taken from RenderUtils.getConvertedUIOutputValue(): public static Object getConvertedUIOutputValue(FacesContext facesContext, UIOutput output, Object submittedValue) throws ConverterException { if (submittedValue != null && !(submittedValue instanceof String)) { if (RendererUtils.NOTHING.equals(submittedValue)) { return null; } throw new IllegalArgumentException("Submitted value of type String for component : " + getPathToComponent(output) + "expected"); } Problem: In my case "submittedValue" *is* an instance of RenderUtils.NOTHING. However, this is not recognized by the above code because it was serialized. As one can see at the declaration of RenderUtils.NOTHING, it is intentionally Serializable. Unfortunately the detection of the value work only for not-serialized values. Possible solution: Implement RenderUtils.NOTHING.equals() to recognize serialized versions of RenderUtils.NOTHING. Application Background (Further explanation of the context): During "apply request values" the component gets RenderUtils.NOTHING assigned as "submittedValue". Usually the submitted value is resetted in the "process validations" phase. But in this case "process validations" is never executed because FacesContext.renderResponse() is called earlier. So, the submitted value (= RenderUtils.NOTHING) remains in the component, gets serialized. On the next round trip the component doesnt receive a "process decodes" because it is disabled, but "process validations" is called on the component, which fails with the attached stack trace. --------- Stacktrace: java.lang.IllegalArgumentException: Submitted value of type String for component : {.....} expected org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedUIOutputValue(RendererUtils.java:591) org.apache.myfaces.shared_impl.renderkit.html.HtmlMenuRendererBase.getConvertedValue(HtmlMenuRendererBase.java:126) javax.faces.component.UIInput.getConvertedValue(UIInput.java:396) javax.faces.component.UIInput.validate(UIInput.java:350) javax.faces.component.UIInput.processValidators(UIInput.java:184) javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:627) javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:627) javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:627) javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:627) javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:627) javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:627) javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:627) javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:627) javax.faces.component.UIForm.processValidators(UIForm.java:73) javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:627) javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:149) org.apache.myfaces.lifecycle.ProcessValidationsExecutor.execute(ProcessValidationsExecutor.java:32) org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95) org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70) javax.faces.webapp.FacesServlet.service(FacesServlet.java:139) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.