Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-5430

i18nsystem: if property files have same name under mgnl-i18n directory, only one of them will be loaded

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • 5.2.6, 5.3
    • 5.1
    • i18n
    • None

      To reproduce:
      1. Create a new message property file in a project that has the same name as the property file in a different project.
      ie we discovered this when trying to create a new shellapp-app-launcher-messages_en.properties in the stk project (one already exists in admincentral at:
      /magnolia-ui-admincentral/src/main/resources/mgnl-i18n/shellapp-app-launcher-messages_en.properties)

      2. Add some keys to it.

      3. Run magnolia and see how only the keys from one of the files are used.

      Analysis:
      files are loaded at: info.magnolia.i18nsystem.DefaultMessageBundlesLoader#loadMessages()
      This uses ClasspathResourcesUtil.findResources(new ClasspathResourcesUtil.Filter()

      findResources uses a HashSet to store found resources. So probably each time a new file with the same name (path) is discovered - it replaces the one that was already in the HashSet.
      I wonder if this was intentional in findResources? My first assumption is that findResources is the problem and the implementation should be changed. Maybe it is assuming that all files come from one parent directory?

      Note the hashmap is working with the full path under the mgnl-i18n directory - so if two files have same name, but one is in a subdirectory - then both files will be loaded as the path is different.

        Acceptance criteria

              Unassigned Unassigned
              czimmermann Christopher Zimmermann
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD