Tapestry
  1. Tapestry
  2. TAPESTRY-2184

Null pointer exception when creating an action link during a component event request

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.10
    • Fix Version/s: 5.0.11
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      createActionLink cause exception when it is called in the page class(see onActionFromDelete), but works when it is called from the template, this works in 5.0.6 and 7, but fails in 5.0.9 and 5.0.10, sample code and error follows:

      public class TestPage1 {
      @Inject
      private ComponentResources resources;
      private Object[] _objs;
      public Class onActivate(Object[] obj)

      { _objs = obj; return null; }

      public Object[] onPassivate()

      { return _objs;}

      Link onActionFromDelete(Long id)

      { String x = getTheLink(); // this fails with exception return null; }

      public String getTheLink()

      { Link l = resources.createActionLink("DeleteConfirm", false); return l.toURI(); }

      public Object onDeleteConfirm(Long id)

      { return null; }

      }

      template:

      <body>
      <t:ActionLink t:id="Delete" context="1">Delete me</t:ActionLink><br />
      <p>My Link is : $

      {theLink}

      </p>
      </body>

      errors:

      java.lang.NullPointerException
      Stack trace

      • org.apache.tapestry.internal.services.LinkFactoryImpl.collectActivationContextForPage(LinkFactoryImpl.java:217)
      • org.apache.tapestry.internal.services.LinkFactoryImpl.createActionLink(LinkFactoryImpl.java:129)
      • org.apache.tapestry.internal.structure.PageImpl.createActionLink(PageImpl.java:156)

        Activity

        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12569370 ] jira [ 12592160 ]
        Mark Thomas made changes -
        Workflow jira [ 12424093 ] Default workflow, editable Closed status [ 12569370 ]
        Howard M. Lewis Ship made changes -
        Resolution Fixed [ 1 ]
        Fix Version/s 5.0.11 [ 12312968 ]
        Status In Progress [ 3 ] Closed [ 6 ]
        Howard M. Lewis Ship made changes -
        Summary Invoking createActionLink() in code throws an NullPointerException even though using an ActionLink component in the template does not Null pointer exception when creating an action link during a component event request
        Howard M. Lewis Ship made changes -
        Summary createActionLink cause exception when it is called in the page class, but works when it is called from the template. Invoking createActionLink() in code throws an NullPointerException even though using an ActionLink component in the template does not
        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 ]
        Angelo Chen created issue -

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development