Tapestry 5
  1. Tapestry 5
  2. TAP5-1141

Type coercion from arbitrary object to Boolean will NPE when the object's toString() returns null (should coerce to false)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.2.0
    • Fix Version/s: 5.2.0
    • Component/s: tapestry-ioc
    • Labels:

      Description

      <div t:type="if" test="user.homePhoneNumber"> Home: $

      {user.homePhoneNumber}

      </div>

      Results in:

      Render queue error in BeginRender[PersonalDetails:if_1]: Failure reading parameter 'test' of component PersonalDetails:if_1: Coercion of null to type java.lang.Boolean (via Object --> String, String --> Boolean) failed: java.lang.NullPointerException

      org.apache.tapestry5.ioc.services.TapestryIOCModule$15.coerce(TapestryIOCModule.java:255)
      org.apache.tapestry5.ioc.services.TapestryIOCModule$15.coerce(TapestryIOCModule.java:252)
      org.apache.tapestry5.ioc.services.CoercionTuple$CoercionWrapper.coerce(CoercionTuple.java:51)
      org.apache.tapestry5.ioc.internal.services.CompoundCoercion.coerce(CompoundCoercion.java:45)
      org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl$TargetCoercion.coerce(TypeCoercerImpl.java:72)
      org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl.coerce(TypeCoercerImpl.java:137)
      org.apache.tapestry5.internal.transform.ParameterWorker$2$1.readFromBinding(ParameterWorker.java:282)
      org.apache.tapestry5.internal.transform.ParameterWorker$2$1.get(ParameterWorker.java:381)
      org.apache.tapestry5.corelib.components.If.test(If.java:45)
      org.apache.tapestry5.corelib.base.AbstractConditional.beginRender(AbstractConditional.java:59)
      org.apache.tapestry5.internal.transform.RenderPhaseMethodWorker$Invoker.invoke(RenderPhaseMethodWorker.java:117)

      I think the special case of null -> String needs to allow for a null object coerced to a (null) String.

        Activity

        Howard M. Lewis Ship made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Fix Version/s 5.2.0 [ 12314122 ]
        Resolution Fixed [ 1 ]
        Howard M. Lewis Ship made changes -
        Labels typecoercer
        Summary TypeCoercion from arbitrary object to Boolean will NPE when the object's toString() returns null (should coerce to false) Type coercion from arbitrary object to Boolean will NPE when the object's toString() returns null (should coerce to false)
        Howard M. Lewis Ship made changes -
        Summary TypeCoercion from arbitrary object to Boolean will NPE when the value is null (should coerce to false) TypeCoercion from arbitrary object to Boolean will NPE when the object's toString() returns null (should coerce to false)
        Howard M. Lewis Ship made changes -
        Priority Critical [ 2 ] Minor [ 4 ]
        Howard M. Lewis Ship made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Howard M. Lewis Ship made changes -
        Field Original Value New Value
        Assignee Howard M. Lewis Ship [ hlship ]
        Priority Major [ 3 ] Critical [ 2 ]
        Howard M. Lewis Ship created issue -

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Howard M. Lewis Ship
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development