[
https://issues.apache.org/jira/browse/WICKET-990?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mark Sandori updated WICKET-990:
--------------------------------
Component/s: wicket
Affects Version/s: 1.3.0-beta3
> 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
>
> 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.