Tapestry 5
  1. Tapestry 5
  2. TAP5-10

An onActivate() event handler on a page can cause PageTester to fail with a NullPointerException

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.15
    • Fix Version/s: 5.0.16
    • Component/s: None
    • Labels:
      None
    • Environment:
      Java 1.5.0_13, Eclipse 3.3.1.1, Windows 2000

      Description

      PageTester.submitForm throws a NullPointerException if the form returns a page that itself forwards to another page via onActivate. For example:

      @Test
      public void testSubmit()

      { Document dom = tester.renderPage("Page1"); tester.submitForm(dom.getElementById("form"), new HashMap<String, String>()); }

      public class Page1 {
      Object onSuccess()

      { return Page2.class; }

      public class Page2 {
      Object onActivate()

      { return Page3.class; }

      FAILED: testSubmit
      java.lang.NullPointerException
      at org.apache.tapestry.internal.test.PageLinkInvoker.invoke(PageLinkInvoker.java:61)
      at org.apache.tapestry.test.PageTester.invoke(PageTester.java:167)
      at org.apache.tapestry.internal.test.ActionLinkInvoker.invoke(ActionLinkInvoker.java:78)
      at org.apache.tapestry.test.PageTester.invoke(PageTester.java:167)
      at org.apache.tapestry.test.PageTester.submitForm(PageTester.java:195)
      at com.acme.app.pages.Page1Test.testSubmit(Page1Test.java:30)

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        303d 17h 40m 1 Howard M. Lewis Ship 07/Nov/08 18:37
        In Progress In Progress Closed Closed
        1h 12m 1 Howard M. Lewis Ship 07/Nov/08 19:50
        Howard M. Lewis Ship made changes -
        Resolution Fixed [ 1 ]
        Status In Progress [ 3 ] Closed [ 6 ]
        Fix Version/s 5.0.16 [ 12313427 ]
        Howard M. Lewis Ship made changes -
        Summary PageTester.submitForm NullPointerException An onActivate() event handler on a page can cause PageTester to fail with a NullPointerException
        Hide
        Howard M. Lewis Ship added a comment -

        Here's the current stack trace, based on the latest 5.0.16-SNAPSHOT:

        java.lang.NullPointerException
        at org.apache.tapestry5.internal.test.PageRenderInvoker.invoke(PageRenderInvoker.java:68)
        at org.apache.tapestry5.test.PageTester.invoke(PageTester.java:203)
        at org.apache.tapestry5.internal.test.ComponentEventInvoker.invoke(ComponentEventInvoker.java:78)
        at org.apache.tapestry5.test.PageTester.invoke(PageTester.java:203)
        at org.apache.tapestry5.test.PageTester.submitForm(PageTester.java:230)
        at com.acme.app.pages.Page1Test.testSubmit(Page1Test.java:30)
        at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62)
        at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:141)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)

        The offending line:

        return markupWriterFactory.getLatestMarkupWriter().getDocument();

        Show
        Howard M. Lewis Ship added a comment - Here's the current stack trace, based on the latest 5.0.16-SNAPSHOT: java.lang.NullPointerException at org.apache.tapestry5.internal.test.PageRenderInvoker.invoke(PageRenderInvoker.java:68) at org.apache.tapestry5.test.PageTester.invoke(PageTester.java:203) at org.apache.tapestry5.internal.test.ComponentEventInvoker.invoke(ComponentEventInvoker.java:78) at org.apache.tapestry5.test.PageTester.invoke(PageTester.java:203) at org.apache.tapestry5.test.PageTester.submitForm(PageTester.java:230) at com.acme.app.pages.Page1Test.testSubmit(Page1Test.java:30) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:141) at org.apache.maven.surefire.Surefire.run(Surefire.java:177) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009) The offending line: return markupWriterFactory.getLatestMarkupWriter().getDocument();
        Howard M. Lewis Ship made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Howard M. Lewis Ship made changes -
        Assignee Howard M. Lewis Ship [ hlship ]
        Howard M. Lewis Ship made changes -
        Affects Version/s 5.0.15 [ 12313429 ]
        Howard M. Lewis Ship made changes -
        Project Tapestry [ 10573 ] Tapestry 5 [ 12310833 ]
        Component/s tapestry-test [ 12311674 ]
        Key TAPESTRY-2029 TAP5-10
        Affects Version/s 5.0.7 [ 12312802 ]
        Franz Amador made changes -
        Field Original Value New Value
        Attachment PageTester-test.zip [ 12372753 ]
        Hide
        Franz Amador added a comment - - edited

        Uploaded Eclipse project test app that demonstrates the problem.

        Show
        Franz Amador added a comment - - edited Uploaded Eclipse project test app that demonstrates the problem.
        Franz Amador created issue -

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development