[MAGNOLIA-6458] I18N mechanism issue: ChildDecorator modifies original definition list fields Created: 09/Dec/15  Updated: 20/Jul/16  Resolved: 07/Apr/16

Status: Closed
Project: Magnolia
Component/s: i18n
Affects Version/s: 5.4.3
Fix Version/s: 5.4.6

Type: Bug Priority: Major
Reporter: Aleksandr Pchelintcev Assignee: Roman Kovařík
Resolution: Fixed Votes: 1
Labels: i18n, support
Remaining Estimate: 0d
Time Spent: 1.25h
Original Estimate: Not Specified

Template:
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:
Sprint: Kromeriz 38
Story Points: 2

 Description   

For some reasons (most likely 'pre-mature optimisation') ChildDecorator handles Lists differently from maps and other types of collections: instead of creating an immutable copy of a list filled with proxied elements - an original collection elements are replaced with proxies => the state of the 'singleton' definition re-used by all the users of the webapp is modified.

As of f6ec736175f156c6081e0b58c2b7f8ee763c3462 it causes problems with translating the definitions that have list fields for users with different locales: original def gets partially i18n-proxied forever and gets stuck with a same LocaleProvider.

Video demonstrating the issue: https://nas.lemonize.de:5001/fbsharing/DVjgi2Xn
Patch with an idea how to fix it: https://gist.github.com/p4elkin/cbccff356553fd9b0a87



 Comments   
Comment by Aleksandr Pchelintcev [ 16/Dec/15 ]

NOTE that the patch provided isn't entirely correct since it produces the immutable maps which might break some functionality that relies on mutability of the lists (i.e. MoveDialogPresenter modifies the tabular view's column lists, adds and removes elements). In fact - those assumptions are bad and definitions in general case MUST be immutable, but for now I propose that the lists produced by ChildDecorator are actually mutable (e.g. wrap a resulting list into Lists.newLinkedList(immutableVersion)).

Comment by Vivian Steller [ 03/Feb/16 ]

Hi folks,
can we please raise the priority of this issue to Critical so that it gets fixed soon? It really breaks the Author I18n mechanism in Magnolia completely.

The patch that Jan provided works great (tested in production). For each and every release we have to recompile magnolia-i18n to keep this patch which is really annoying.

Thanks a lot,
Cheers,

Vivian

Generated at Mon Feb 12 04:14:42 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.