You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Davor Hrg (JIRA)" <de...@tapestry.apache.org> on 2008/02/21 10:14:46 UTC

[jira] Commented: (TAPESTRY-2184) createActionLink cause exception when it is called in the page class, but works when it is called from the template.

    [ https://issues.apache.org/jira/browse/TAPESTRY-2184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570987#action_12570987 ] 

Davor Hrg commented on TAPESTRY-2184:
-------------------------------------

LinkFactoryImpl(line:127)

    Page activePage = _pageRenderQueue.getRenderingPage();

this is null in this case ...
   I'm not sure if it is safe to assume:
   
   if(activePage == null) activePage = page;

for this case this would be ok, but some other situation may misbehave ...






> createActionLink cause exception when it is called in the page class,  but works when it is called from the template. 
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2184
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2184
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.0.10
>            Reporter: Angelo Chen
>
> 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)

-- 
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: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org