Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-983

CLONE -NPE in BeanDisplay if used in a form with a default model

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.3.6, 5.1.0.5, 5.0.15
    • Fix Version/s: 5.4, 5.3.8
    • Component/s: tapestry-core
    • Labels:
      None
    • Environment:
      Ubuntu Linux, Apache Tomcat

      Description

      Create something like this:

      <t:form>
      <t:beandisplay object="foo" include="bar" />
      </t:form>

      and submit the form. You get a NPE in beandisplay. The workaround is to create the model yourself.

        Issue Links

          Activity

          Hide
          windy Stephan Windmüller added a comment -

          I created a minimal page which shows the error in Tapestry 5.1.0:

          TestObject.java:

          public class TestObject {

          private String test;

          public String getTest()

          { return test; }

          public void setTest(String test)

          { this.test = test; }

          }

          TestPage.java:

          import org.apache.tapestry5.annotations.Property;

          public class TestPage {
          @Property
          private TestObject testObject;

          void onPrepare()

          { testObject = new TestObject(); testObject.setTest("Test String"); }

          }

          TestPage.tml:

          <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
          <head>
          <title>Test Page</title>
          </head>
          <body>
          <t:form>
          <t:beandisplay object="testObject"/>
          <t:submit/>
          </t:form>
          </body>
          </html>

          StackTrace after submitting the form:

          Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Failure reading parameter 'source' of component TestPage:beandisplay.loop: Property 'model' (within property expression 'model.propertyNames', of org.apache.tapestry5.corelib.components.BeanDisplay@162595) is null. [at classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line 4]
          at org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:495)
          at org.apache.tapestry5.corelib.components.Form._$advised$onAction(Form.java:378)
          at org.apache.tapestry5.corelib.components.Form$onAction$invocation_12627b12cc9.invokeAdvisedMethod(Form$onAction$invocation_12627b12cc9.java)
          at org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:71)
          at org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvice.java:37)
          at org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54)
          at org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:80)
          at org.apache.tapestry5.corelib.components.Form.onAction(Form.java)
          at org.apache.tapestry5.corelib.components.Form.dispatchComponentEvent(Form.java)
          at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:910)
          at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1081)
          ... 55 more
          Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Failure reading parameter 'source' of component TestPage:beandisplay.loop: Property 'model' (within property expression 'model.propertyNames', of org.apache.tapestry5.corelib.components.BeanDisplay@162595) is null. [at classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line 4]
          at org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl$1.read(InternalComponentResourcesImpl.java:516)
          at org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl$1.read(InternalComponentResourcesImpl.java:496)
          at org.apache.tapestry5.corelib.components.Loop._$read_parameter_source(Loop.java)
          at org.apache.tapestry5.corelib.components.Loop.setupForVolatile(Loop.java:358)
          at org.apache.tapestry5.corelib.components.Loop.access$100(Loop.java:44)
          at org.apache.tapestry5.corelib.components.Loop$2.execute(Loop.java:75)
          at org.apache.tapestry5.corelib.components.Loop$2.execute(Loop.java:79)
          at org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:480)
          ... 65 more
          Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Property 'model' (within property expression 'model.propertyNames', of org.apache.tapestry5.corelib.components.BeanDisplay@162595) is null. [at classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line 4]
          at org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:62)
          at org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl$1.read(InternalComponentResourcesImpl.java:510)
          ... 72 more
          Caused by: java.lang.NullPointerException: Property 'model' (within property expression 'model.propertyNames', of org.apache.tapestry5.corelib.components.BeanDisplay@162595) is null.
          at org.apache.tapestry5.internal.services.PropertyConduitSourceImpl.nullTerm(PropertyConduitSourceImpl.java:1256)
          at $PropertyConduit_12627b119a9.navigate($PropertyConduit_12627b119a9.java)
          at $PropertyConduit_12627b119a9.get($PropertyConduit_12627b119a9.java)
          at org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:58)
          ... 73 more

          Show
          windy Stephan Windmüller added a comment - I created a minimal page which shows the error in Tapestry 5.1.0: TestObject.java: public class TestObject { private String test; public String getTest() { return test; } public void setTest(String test) { this.test = test; } } TestPage.java: import org.apache.tapestry5.annotations.Property; public class TestPage { @Property private TestObject testObject; void onPrepare() { testObject = new TestObject(); testObject.setTest("Test String"); } } TestPage.tml: <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"> <head> <title>Test Page</title> </head> <body> <t:form> <t:beandisplay object="testObject"/> <t:submit/> </t:form> </body> </html> StackTrace after submitting the form: Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Failure reading parameter 'source' of component TestPage:beandisplay.loop: Property 'model' (within property expression 'model.propertyNames', of org.apache.tapestry5.corelib.components.BeanDisplay@162595) is null. [at classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line 4] at org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:495) at org.apache.tapestry5.corelib.components.Form._$advised$onAction(Form.java:378) at org.apache.tapestry5.corelib.components.Form$onAction$invocation_12627b12cc9.invokeAdvisedMethod(Form$onAction$invocation_12627b12cc9.java) at org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:71) at org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvice.java:37) at org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54) at org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:80) at org.apache.tapestry5.corelib.components.Form.onAction(Form.java) at org.apache.tapestry5.corelib.components.Form.dispatchComponentEvent(Form.java) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:910) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1081) ... 55 more Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Failure reading parameter 'source' of component TestPage:beandisplay.loop: Property 'model' (within property expression 'model.propertyNames', of org.apache.tapestry5.corelib.components.BeanDisplay@162595) is null. [at classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line 4] at org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl$1.read(InternalComponentResourcesImpl.java:516) at org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl$1.read(InternalComponentResourcesImpl.java:496) at org.apache.tapestry5.corelib.components.Loop._$read_parameter_source(Loop.java) at org.apache.tapestry5.corelib.components.Loop.setupForVolatile(Loop.java:358) at org.apache.tapestry5.corelib.components.Loop.access$100(Loop.java:44) at org.apache.tapestry5.corelib.components.Loop$2.execute(Loop.java:75) at org.apache.tapestry5.corelib.components.Loop$2.execute(Loop.java:79) at org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:480) ... 65 more Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Property 'model' (within property expression 'model.propertyNames', of org.apache.tapestry5.corelib.components.BeanDisplay@162595) is null. [at classpath:org/apache/tapestry5/corelib/components/BeanDisplay.tml, line 4] at org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:62) at org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl$1.read(InternalComponentResourcesImpl.java:510) ... 72 more Caused by: java.lang.NullPointerException: Property 'model' (within property expression 'model.propertyNames', of org.apache.tapestry5.corelib.components.BeanDisplay@162595) is null. at org.apache.tapestry5.internal.services.PropertyConduitSourceImpl.nullTerm(PropertyConduitSourceImpl.java:1256) at $PropertyConduit_12627b119a9.navigate($PropertyConduit_12627b119a9.java) at $PropertyConduit_12627b119a9.get($PropertyConduit_12627b119a9.java) at org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:58) ... 73 more
          Hide
          ulrich.staerk Ulrich Stärk added a comment -

          This issue has been last updated more than 1.5 years ago, has no assignee, affects an old version of Tapestry that is not actively developed anymore, and is therefore prone to be bulk-closed in the near future.

          If the issue still persists with the most recent development preview of Tapestry, please update it as soon as possible. In the case of a feature request, please discuss it with the Tapestry developer community on the dev@tapestry.apache.org mailing list first.

          Show
          ulrich.staerk Ulrich Stärk added a comment - This issue has been last updated more than 1.5 years ago, has no assignee, affects an old version of Tapestry that is not actively developed anymore, and is therefore prone to be bulk-closed in the near future. If the issue still persists with the most recent development preview of Tapestry, please update it as soon as possible. In the case of a feature request, please discuss it with the Tapestry developer community on the dev@tapestry.apache.org mailing list first.
          Hide
          windy Stephan Windmüller added a comment -

          This bug is still present in 5.3.6. I will test it with 5.4 as soon as it is released.

          Show
          windy Stephan Windmüller added a comment - This bug is still present in 5.3.6. I will test it with 5.4 as soon as it is released.
          Hide
          thiagohp Thiago H. de Paula Figueiredo added a comment -

          TAP5-2270 was already fixed and had the same source as this ticket.

          Show
          thiagohp Thiago H. de Paula Figueiredo added a comment - TAP5-2270 was already fixed and had the same source as this ticket.

            People

            • Assignee:
              Unassigned
              Reporter:
              windy Stephan Windmüller
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development