[ 
http://issues.apache.org/jira/browse/TAPESTRY-701?page=comments#action_12358241 
] 

Howard M. Lewis Ship commented on TAPESTRY-701:
-----------------------------------------------

Having trouble reproducing this with CVS head (approx. beta-14).

In my page class code:

public abstract class Redirect extends BasePage
{
    @InjectObject("engine-service:page")
    public abstract IEngineService getPageService();

    @Persist("client")
    public abstract String getMessage();

    public void hardRedirect()
    {
        String url = getPageService().getLink(false, getPageName()).getURL();

        throw new RedirectException(url);
    }

    public ILink softRedirect()
    {
        return getPageService().getLink(false, getPageName());
    }
}

I have two forms on the page, with a TextField to update message; one invokes 
hardRedirect(), one invokes softRedirect().

The page seems to work just fine for me ... which makes sense, because 
IRequestCycle.getPage() will not be null.

Likewise, the external service will activate a page before invoking the page's 
activateExternalPage() method, so even redirecting from there won't work.  And 
when a PageValidateListener throws a PageRedirectException, some page will 
become the active page.

I can't think of a scenario where you would get to that link of code with a 
null page, but maybe I'm not smart enough.

> NullPointerException in PageClientPropertyPersistenceScope when using 
> 'client' persistence strategy and executing a ServiceLink
> -------------------------------------------------------------------------------------------------------------------------------
>
>          Key: TAPESTRY-701
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-701
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>  Environment: WinXP Pro, JBOSS 4.0.3RC1
>     Reporter: Scott Jarvi
>     Assignee: Howard M. Lewis Ship
>     Priority: Minor

>
> A page that's using the 'client' persistence strategy for one of its 
> properties includes a ServiceLink that triggers a subclass of RestartService. 
> The service logs the user out, invalidates the session and then tries to 
> redirect the user back to the 'Home' page, using HomeService.getLink().  
> However, trying to get the link from the HomeService resulted in a NPE...
> org.apache.tapestry.record.PageClientPropertyPersistenceScope.shouldEncodeState(PageClientPropertyPersistenceScope.java:45)
> $ClientPropertyPersistenceScope_106dad08dcb.shouldEncodeState($ClientPropertyPersistenceScope_106dad08dcb.java)
> org.apache.tapestry.record.ClientPropertyPersistenceStrategy.addParametersForPersistentProperties(ClientPropertyPersistenceStrategy.java:136)
> $PropertyPersistenceStrategy_106dad08dc7.addParametersForPersistentProperties($PropertyPersistenceStrategy_106dad08dc7.java)
> $PropertyPersistenceStrategy_106dad08dc8.addParametersForPersistentProperties($PropertyPersistenceStrategy_106dad08dc8.java)
> org.apache.tapestry.record.PropertyPersistenceStrategySourceImpl.addParametersForPersistentProperties(PropertyPersistenceStrategySourceImpl.java:99)
> $PropertyPersistenceStrategySource_106dad08d18.addParametersForPersistentProperties($PropertyPersistenceStrategySource_106dad08d18.java)
> org.apache.tapestry.services.impl.LinkFactoryImpl.constructLink(LinkFactoryImpl.java:112)
> $LinkFactory_106dad08ca2.constructLink($LinkFactory_106dad08ca2.java)
> org.apache.tapestry.engine.HomeService.getLink(HomeService.java:58)
> (rest of stack trace omitted)
> It seems that the NullPointer is caused by a null IPage in the RequestCycle, 
> which PageClientPropertyPersistenceScope tries to check to determine if 
> encoding should be applied.  

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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

Reply via email to