[
https://issues.apache.org/jira/browse/CLK-561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12724592#action_12724592
]
Bob Schellink commented on CLK-561:
-----------------------------------
Actually the ConfigService.getPagePath says: "IllegalArgumentException - if the
Page Class is not configured with a unique path". Basically if you configure
multiple templates to the same Page and invoke getPagePath, Click won't know
which template to return so it throws an exception.
Not sure if we can easily change things at this stage as some code might be
dependent on the current behavior.
For the interim one can do this in a BorderPage:
public class BorderPage extends PAge {
public void setForward(Class pageClass) {
String path = getContext().getPagePath(pageClass);
if(path ==null) {
throw new IAE
}
...
}
}
> Page#setForward(Class) silently fails for a non-existing .htm
> -------------------------------------------------------------
>
> Key: CLK-561
> URL: https://issues.apache.org/jira/browse/CLK-561
> Project: Click
> Issue Type: Bug
> Components: core
> Affects Versions: 2.1.0
> Reporter: WarnerJan Veldhuis
>
> When setting a forward in a page, and the corresponding .htm is missing,
> Page#setForward(Class) will silently fail, and Page#getForward() will return
> null. Eventually, you will remain on the current page, since ClickServlet
> wasn't told otherwise.
> Example:
> IndexPage.java
> ...
> public boolean onLogin() {
> ...
> if ( isLoggedIn ) {
> setForward(HomePage.class);
> return false;
> }
> ...
> }
> If home.htm is missing, setForward will set the forward field to null, while
> I would expect it to barf with an IllegalArgumentException. The javadoc of
> ConfigService#getPagePath(Class) also says: "@throws IllegalArgumentException
> if the Page Class is not configured"
> Proposed solution:
> Instead of returning null in XmlConfigService#getPagePage(Class), throw an
> IAE.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.