MyFaces Core
  1. MyFaces Core
  2. MYFACES-990

Unhelpful stack trace when tag value binding returns wrong type.

    Details

    • Type: Improvement Improvement
    • Status: Patch Available
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.1.1
    • Fix Version/s: None
    • Component/s: General
    • Labels:
      None

      Description

      In the implementation of each UIComponent, the canonical logic for retrieving a non-String property is to cast the result
      of the valueBinding.getValue() method to the expected type.

      public boolean isItemDisabled()

      { if (_itemDisabled != null) return _itemDisabled.booleanValue(); ValueBinding vb = getValueBinding("itemDisabled"); Boolean v = vb != null ? (Boolean)vb.getValue(getFacesContext()) : null; return v != null ? v.booleanValue() : DEFAULT_ITEMDISABLED; }

      Yields an obscure stack trace that doesn't yield the ID of the component or the property that is being referenced:

      ERROR 14:45:28 [[jsp]] Servlet.service() for servlet jsp threw exception
      java.lang.ClassCastException: java.lang.String
      at javax.faces.component.html.HtmlInputText.isDisabled(HtmlInputText.java:117)
      at org.apache.myfaces.renderkit.html.HtmlTextRendererBase.isDisabled(HtmlTextRendererBase.java:157)
      at org.apache.myfaces.renderkit.html.ext.HtmlTextRenderer.isDisabled(HtmlTextRenderer.java:45)
      at org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:144)
      at org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:50)
      at org.apache.myfaces.renderkit.html.ext.HtmlTextRenderer.renderNormal(HtmlTextRenderer.java:72)
      at org.apache.myfaces.renderkit.html.ext.HtmlTextRenderer.encodeEnd(HtmlTextRenderer.java:58)

        Activity

          People

          • Assignee:
            Martin Marinschek
            Reporter:
            Steve Peterson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development