Tapestry
  1. Tapestry
  2. TAPESTRY-1648

Coercing from null to BigDecimal causes an NPE

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 5.0.5
    • Fix Version/s: 5.0.6
    • Component/s: tapestry-ioc
    • Labels:
      None

      Description

      I'm working on a currency textfield for bigdecimal and I get this exception because it tries to coerce from null to String (which returns null) and then passes a null into the BigDecimal(String) constructor which causes the NPE.

      org.apache.tapestry.ioc.internal.util.TapestryException: Failure reading parameter value of component CurrencyFieldTestPage:value: Coercion of null to type java.math.BigDecimal (via null --> String, String --> java.math.BigDecimal) failed: java.lang.NullPointerException [at classpath:com/ifactory/cms/cms/integration/app0/pages/CurrencyFieldTestPage.html, line 5, column 78]
      at org.apache.tapestry.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:935)
      at org.apache.tapestry.internal.structure.ComponentPageElementImpl.access$100(ComponentPageElementImpl.java:69)
      at org.apache.tapestry.internal.structure.ComponentPageElementImpl$10.render(ComponentPageElementImpl.java:349)
      at org.apache.tapestry.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:57)
      at org.apache.tapestry.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:40)
      at $PageMarkupRenderer_113c1389a35.renderPageMarkup($PageMarkupRenderer_113c1389a35.java)
      at org.apache.tapestry.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:71)
      at $PageResponseRenderer_113c13899fc.renderPageResponse($PageResponseRenderer_113c13899fc.java)
      at org.apache.tapestry.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:81)
      at $PageRenderRequestHandler_113c13899f1.handle($PageRenderRequestHandler_113c13899f1.java)
      at org.apache.tapestry.internal.test.PageLinkInvoker.invoke(PageLinkInvoker.java:57)
      at org.apache.tapestry.test.PageTester.invoke(PageTester.java:184)
      at org.apache.tapestry.test.PageTester.renderPage(PageTester.java:144)
      at com.ifactory.cms.cms.components.CurrencyFieldTest.testFormatting(CurrencyFieldTest.java:23)
      Caused by: org.apache.tapestry.ioc.internal.util.TapestryException: Failure reading parameter value of component CurrencyFieldTestPage:value: Coercion of null to type java.math.BigDecimal (via null --> String, String --> java.math.BigDecimal) failed: java.lang.NullPointerException
      at org.apache.tapestry.internal.structure.InternalComponentResourcesImpl.readParameter(InternalComponentResourcesImpl.java:210)
      at com.ifactory.cms.cms.components.CurrencyField._$read_parameter_value(CurrencyField.java)
      at com.ifactory.cms.cms.components.CurrencyField.beginRender(CurrencyField.java:109)
      at com.ifactory.cms.cms.components.CurrencyField.beginRender(CurrencyField.java)
      at org.apache.tapestry.internal.structure.ComponentPageElementImpl$10$1.run(ComponentPageElementImpl.java:345)
      at org.apache.tapestry.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:931)
      ... 34 more
      Caused by: java.lang.RuntimeException: Coercion of null to type java.math.BigDecimal (via null --> String, String --> java.math.BigDecimal) failed: java.lang.NullPointerException
      at org.apache.tapestry.ioc.internal.services.TypeCoercerImpl.coerce(TypeCoercerImpl.java:154)
      at $TypeCoercer_113c13899e0.coerce($TypeCoercer_113c13899e0.java)
      at org.apache.tapestry.internal.structure.InternalComponentResourcesImpl.readParameter(InternalComponentResourcesImpl.java:206)
      ... 39 more
      Caused by: java.lang.NullPointerException
      at java.math.BigDecimal.<init>(BigDecimal.java:594)
      at org.apache.tapestry.ioc.services.TapestryIOCModule$7.coerce(TapestryIOCModule.java:219)
      at org.apache.tapestry.ioc.services.TapestryIOCModule$7.coerce(TapestryIOCModule.java:217)
      at org.apache.tapestry.ioc.services.CoercionTuple$CoercionWrapper.coerce(CoercionTuple.java:53)
      at org.apache.tapestry.ioc.internal.services.CompoundCoercion.coerce(CompoundCoercion.java:48)
      at org.apache.tapestry.ioc.internal.services.TypeCoercerImpl.coerce(TypeCoercerImpl.java:150)
      ... 41 more
      ... Removed 21 stack frames

        Activity

        No work has yet been logged on this issue.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development