[MAGNOLIA-5635] i18n message bundle resolver cannot handle identical named files Created: 23/Jan/14 Updated: 16/Sep/15 Resolved: 03/Jun/14 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | i18n |
| Affects Version/s: | 5.2.1 |
| Fix Version/s: | 5.2.6, 5.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | David Nyffenegger | Assignee: | Federico Grilli |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Template: |
|
||||||||||||||||||||||||||||||||
| Patch included: |
Yes
|
||||||||||||||||||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||||||||||||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||||||||||||||||||||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||||||||||||||||||||||||||
| Date of First Response: | |||||||||||||||||||||||||||||||||
| Description |
|
Assume two or more modules have a message bundle with the same name in their /mgnl-i18n/ directory. The current message bundle resolvers loads just one of them - all other are silently ignored. Please consider using this method or fixing it up otherwise. The current implementation is dangerous. Workaround: add prefixes to the message bundles and hope, that no other module uses the same prefix/name. |
| Comments |
| Comment by David Nyffenegger [ 23/Jan/14 ] |
|
A patch could look like that: In info.magnolia.cms.util.ClasspathResourcesUtil add a method getResources: info.magnolia.cms.util.ClasspathResourcesUtil /**
* Get the resource using the current class loader. The leading / is removed as the call to class.getResource()
* would do.
* @param name
* @return the resource
*/
public static Enumeration<URL> getResources(String name) {
return getCurrentClassLoader().getResources(StringUtils.removeStart(name, "/"));
}
In the method loadMessages of info.magnolia.i18nsystem.DefaultMessageBundlesLoader use this new method instead the getStream method and iterate over the returned urls for loading the message bundles. |
| Comment by Daniel Lipp [ 03/Jun/14 ] |
|
Reopening for two reasons: |