You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Igor Vaynberg (JIRA)" <ji...@apache.org> on 2007/09/21 18:01:50 UTC
[jira] Resolved: (WICKET-990) Localizer complains about component
not being added to the page when the component is a page
[ https://issues.apache.org/jira/browse/WICKET-990?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Igor Vaynberg resolved WICKET-990.
----------------------------------
Resolution: Fixed
Fix Version/s: 1.3.0-beta4
Assignee: Igor Vaynberg
> Localizer complains about component not being added to the page when the component is a page
> --------------------------------------------------------------------------------------------
>
> Key: WICKET-990
> URL: https://issues.apache.org/jira/browse/WICKET-990
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.0-beta3
> Reporter: Mark Sandori
> Assignee: Igor Vaynberg
> Fix For: 1.3.0-beta4
>
>
> In Localizer, this code doesn't correctly detect when the component is actually a page:
> public String getString(final String key, final Component component, final IModel model,
> final String defaultValue) throws MissingResourceException
> {
> final IResourceSettings resourceSettings = Application.get().getResourceSettings();
> boolean addedToPage = (component != null && null != component.findParent(Page.class));
> if (!addedToPage)
> {
> logger
> .warn(
> "Tried to retrieve a localized string for a component that has not yet been added to the page. "
> + "This can sometimes lead to an invalid or no localized resource returned. "
> + "Make sure you are not calling Component#getString() inside your Component's constructor. "
> + "Offending component: {}", component);
> }
> This results in excessive warnings in the logs when attempting to use the Page as the root for a resource lookup. This is such a common idiom that it should be accounted for. For instance, the javadoc description for StringResourceModel includes examples of using the page as the component for the resource lookup.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.