uel
  1. uel
  2. UEL-28

Object expression getting coerced to String incorrectly

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      I'll attach the test war, but here are the details. Consider this page:

      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <f:view>
      <h:form>

      <h:commandButton binding="#

      {viewScopedBean.commandButton}

      "id="submit" value="reload"/>
      </h:form>
      </f:view>

      Where the bean and getter are like this:

      package com.sun.faces.component;

      import javax.faces.application.Application;
      import javax.faces.bean.ManagedBean;
      import javax.faces.bean.ViewScoped;
      import javax.faces.component.UICommand;
      import javax.faces.context.FacesContext;

      @ManagedBean(name="viewScopedBean")
      @ViewScoped
      public class ViewScopedComponentBindingBean {

      private UICommand button = null;

      public UICommand getCommandButton () {
      if (null == button)

      { FacesContext context = FacesContext.getCurrentInstance(); Application app = context.getApplication(); button = (UICommand) app.createComponent(context, "javax.faces.Command", "javax.faces.Button"); }

      return button;
      }
      }

      For some reason, the button is getting coerced into a String in AstCompositeExpression.getValue():

      public Object getValue(EvaluationContext ctx)
      throws ELException {
      StringBuffer sb = new StringBuffer(16);
      Object obj = null;
      if (this.children != null) {
      for (int i = 0; i < this.children.length; i++) {
      obj = this.children[i].getValue(ctx);
      if (obj != null)

      { sb.append(obj); }

      }
      }
      return sb.toString();
      }
      }

      I don't even know why AstCompositeExpression is getting into the picture, the expression does not appear to be a composite expression.

        Activity

        Hide
        Ed Burns added a comment -

        Deploy this war to GlassFish 3.1.2 or GlassFish 3.1.1 and visit

        http://127.0.0.1:8080/jsf-systest/faces/component03.jsp

        You'll see the exception mentioned in the issue summary.

        Show
        Ed Burns added a comment - Deploy this war to GlassFish 3.1.2 or GlassFish 3.1.1 and visit http://127.0.0.1:8080/jsf-systest/faces/component03.jsp You'll see the exception mentioned in the issue summary.
        Hide
        Ed Burns added a comment -

        There was an errant whitespace in the JSP. The bug is invalid.

        Show
        Ed Burns added a comment - There was an errant whitespace in the JSP. The bug is invalid.

          People

          • Assignee:
            Unassigned
            Reporter:
            Ed Burns
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: