Tapestry
  1. Tapestry
  2. TAPESTRY-1765

getting language independent messages fails

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 4.1.3
    • Fix Version/s: 4.1.7
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      WinXP SP2, Java 1.5.0_11, Tapestry 4.1.3, Hivemind 1.1.1

      Description

      When I call getMessages().getMessage() in a page with a message key, which only exists in the default properties file (app.properties, and not in app_de.properties for example), no message is being returned, but only the key "[MESSAGE_KEY]". Before the update from Tapestry 4.1.2 to 4.1.3, this problem did not occured.

        Issue Links

          Activity

          Hide
          Patrick Klein added a comment -

          Hello Ulli,

          that's exactly what i also realised. The unit test is working as it should (even with the patches i made to it) with the original version, but with our application using a tomcat servlet container i could reproduce the problem with the original version with ease.
          I'm a bit at a loss at this point...

          Regards,
          Patrick

          Show
          Patrick Klein added a comment - Hello Ulli, that's exactly what i also realised. The unit test is working as it should (even with the patches i made to it) with the original version, but with our application using a tomcat servlet container i could reproduce the problem with the original version with ease. I'm a bit at a loss at this point... Regards, Patrick
          Hide
          Ulrich Stärk added a comment -

          Somehow I'm not able to successfully write a unit test demonstrating the issue. All my tests either work or don't take into account a localized app.properties at all. I don't quite know what to do next, does anyone have an idea?

          I'm not felling good about changing behavior without having a working test...

          Uli

          Show
          Ulrich Stärk added a comment - Somehow I'm not able to successfully write a unit test demonstrating the issue. All my tests either work or don't take into account a localized app.properties at all. I don't quite know what to do next, does anyone have an idea? I'm not felling good about changing behavior without having a working test... Uli
          Hide
          Patrick Klein added a comment -

          When I thought that no one would bother to fix this...
          The patch you posted works in my local tests like charm

          Show
          Patrick Klein added a comment - When I thought that no one would bother to fix this... The patch you posted works in my local tests like charm
          Hide
          Tapan Singh Pratihar added a comment -

          I don't think that fix attached for ComponentMessagesSourceImpl.java would resolve the issue. The putAll(Map) method would still create a problem. It does not copy the defaults property list contained in the Properties object. The result object obtained in each iteration should be the parent properties object for the next iteration.
          assembleNamespaceProperties method should take parent (Properties) parameter:
          private Properties assembleNamespaceProperties(INamespace namespace, Map propertiesMap, Properties parent, Locale locale)

          { ....... // Build them back up in reverse order. //This should be commented //Properties parent = _emptyProperties; Iterator i = localizations.iterator(); ......... }

          and getNamespaceProperties(..) should be modified to:
          private Properties getNamespaceProperties(IComponent component, Locale locale)
          {
          .....

          for (int i=spaceList.size() - 1; i > 1; i-)

          { INamespace space = (INamespace)spaceList.get(i); result = assembleNamespaceProperties(space, findPropertiesMapForResource(space.getSpecificationLocation()), result, locale); ..... }
          Show
          Tapan Singh Pratihar added a comment - I don't think that fix attached for ComponentMessagesSourceImpl.java would resolve the issue. The putAll(Map) method would still create a problem. It does not copy the defaults property list contained in the Properties object. The result object obtained in each iteration should be the parent properties object for the next iteration. assembleNamespaceProperties method should take parent (Properties) parameter: private Properties assembleNamespaceProperties(INamespace namespace, Map propertiesMap, Properties parent, Locale locale) { ....... // Build them back up in reverse order. //This should be commented //Properties parent = _emptyProperties; Iterator i = localizations.iterator(); ......... } and getNamespaceProperties(..) should be modified to: private Properties getNamespaceProperties(IComponent component, Locale locale) { ..... for (int i=spaceList.size() - 1; i > 1; i -) { INamespace space = (INamespace)spaceList.get(i); result = assembleNamespaceProperties(space, findPropertiesMapForResource(space.getSpecificationLocation()), result, locale); ..... }
          Hide
          Patrick Klein added a comment - - edited

          darn... the attached unit test is not working as intended, it actually says ok to the old version as well (just rechecked) :|
          I guess something there is behaving differently as in a tomcat environment

          Show
          Patrick Klein added a comment - - edited darn... the attached unit test is not working as intended, it actually says ok to the old version as well (just rechecked) :| I guess something there is behaving differently as in a tomcat environment
          Hide
          Patrick Klein added a comment -

          Sorry about the mess while attaching the patches...

          The modifications are locally tested and work with the provided unit tests. Additionally the unit tests are extended to ensure the functionality for future versions

          Show
          Patrick Klein added a comment - Sorry about the mess while attaching the patches... The modifications are locally tested and work with the provided unit tests. Additionally the unit tests are extended to ensure the functionality for future versions
          Hide
          Patrick Klein added a comment -

          Modified unit test to ensure localization fallback compatibility for future version

          Show
          Patrick Klein added a comment - Modified unit test to ensure localization fallback compatibility for future version
          Hide
          Patrick Klein added a comment -

          Patch for org.apache.tapersty.services.impl.ComponentMessagesSourceImpl.java

          Locally tested and working with all test, extended test to ensure the functionality in future version are contained in the next three attachments

          Show
          Patrick Klein added a comment - Patch for org.apache.tapersty.services.impl.ComponentMessagesSourceImpl.java Locally tested and working with all test, extended test to ensure the functionality in future version are contained in the next three attachments
          Hide
          Patrick Klein added a comment -

          patch to properties files as part of unit test for org.apache.tapestry.services.impl.ComponentMessagesSourceImpl.java

          Show
          Patrick Klein added a comment - patch to properties files as part of unit test for org.apache.tapestry.services.impl.ComponentMessagesSourceImpl.java
          Hide
          Patrick Klein added a comment -

          patch to properties files as part of unit test for org.apache.tapestry.services.impl.ComponentMessagesSourceImpl.java

          Show
          Patrick Klein added a comment - patch to properties files as part of unit test for org.apache.tapestry.services.impl.ComponentMessagesSourceImpl.java
          Hide
          Patrick Klein added a comment -

          patch to properties files as part of unit test for org.apache.tapestry.services.impl.ComponentMessagesSourceImpl.java

          Show
          Patrick Klein added a comment - patch to properties files as part of unit test for org.apache.tapestry.services.impl.ComponentMessagesSourceImpl.java
          Hide
          Patrick Klein added a comment -

          patch to properties files as part of unit test for org.apache.tapestry.services.impl.ComponentMessagesSourceImpl.java

          Show
          Patrick Klein added a comment - patch to properties files as part of unit test for org.apache.tapestry.services.impl.ComponentMessagesSourceImpl.java
          Hide
          Patrick Klein added a comment -

          Patch for org.apache.tapersty.services.impl.ComponentMessagesSourceImpl.java

          Locally tested and working with all test, extended test to ensure the functionality in future version are contained in the next three attachments

          Show
          Patrick Klein added a comment - Patch for org.apache.tapersty.services.impl.ComponentMessagesSourceImpl.java Locally tested and working with all test, extended test to ensure the functionality in future version are contained in the next three attachments
          Hide
          Patrick Klein added a comment - - edited

          The problem lies in org.apache.tapestry.services.impl.ComponentMessagesSourceImpl.getNamespaceProperties(...)
          Switching back to the way used before revision 556780 works but breaks the unit test org.apache.tapestry.junit.TestComponentMessages.test_Component_Property_From_Application(...)

          Show
          Patrick Klein added a comment - - edited The problem lies in org.apache.tapestry.services.impl.ComponentMessagesSourceImpl.getNamespaceProperties(...) Switching back to the way used before revision 556780 works but breaks the unit test org.apache.tapestry.junit.TestComponentMessages.test_Component_Property_From_Application(...)
          Hide
          Christian Nutz added a comment -

          Still present in 4.1.5

          PLEASE fix this in next release !!!

          Show
          Christian Nutz added a comment - Still present in 4.1.5 PLEASE fix this in next release !!!
          Hide
          Ulrich Stärk added a comment -

          could have been introduced with revision 556780

          Show
          Ulrich Stärk added a comment - could have been introduced with revision 556780

            People

            • Assignee:
              Ulrich Stärk
              Reporter:
              Christian Nutz
            • Votes:
              7 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:

                Development