PackageStringResourceLoader does not look up to superclasses
------------------------------------------------------------
Key: WICKET-2539
URL: https://issues.apache.org/jira/browse/WICKET-2539
Project: Wicket
Issue Type: Improvement
Components: wicket
Affects Versions: 1.4.2
Reporter: Daniel Stoch
>From wicket-devlist:
"ComponentStringResourceLoader attempts to find the resource from given
component stack and if not found, then it tries to find a resource in component
class hierarchy. Method:
public String loadStringResource(Class<?> clazz, final String key, final Locale
locale, final String style)
performs a loop through superclasses of the given clazz.
But in PackageStringResourceLoader implementation the same method only checks
the given clazz and does not perform a check in superclasses. I think it should
to handle such scenario:
1. Component com.aaa.CompA has a resource string defined in
"package.properties" file in package com.aaa.
2. In some other package (eg. com.bbb) I'm using CompA component and overriding
its one method (so I've created a new subclass of CompA). Then resource strings
from "package.properties" in package com.aaa will not be loaded."
I've attached a quickstart app. It contains a simple implementation of
PackageStringResourceLoader (PackageSuperStringResourceLoader - for
demonstration purposes only) which look up superclasses to find a resource
string.
When you run this app and enter a HomePage you should see an error:
java.util.MissingResourceException: Unable to find property: 'sampleKey' for
component: panel2 [class=com.company.application.HomePage$1]
When you uncomment this line in WicketApplication init() method:
getResourceSettings().addStringResourceLoader(new
PackageSuperStringResourceLoader());
then HomePage renders ok.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.