Coercing from null to BigDecimal causes an NPE
----------------------------------------------

                 Key: TAPESTRY-1648
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1648
             Project: Tapestry
          Issue Type: Bug
          Components: tapestry-ioc
    Affects Versions: 5.0.5
            Reporter: Dan Adams
            Priority: Blocker
             Fix For: 5.0.6


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


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to