Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-3580

MessageSourceService.getMessage methods that take a MessageSourceResolvable should return the proper default message

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • TBD
    • Resolution: Fixed
    • OpenMRS 1.9.0, OpenMRS 1.9.1, OpenMRS 1.9.2, OpenMRS 1.9.3, OpenMRS 1.9.4, OpenMRS 1.9.5, OpenMRS 1.9.6, OpenMRS 1.9.7, OpenMRS 1.9.8, Platform 1.9.9, Platform 1.9.10, Platform 1.10.0, Platform 1.10.1, Platform 1.10.2, Platform 1.10.3, Platform 1.11.0, Platform 1.11.1, Platform 1.11.2, Platform 1.11.3, Platform 1.11.4, Platform 1.11.5
    • None
    • None

    Description

      In the UI Framework module, I am working with some Spring errors objects that have multiple message codes (though this isn't specific to the UI Framework module.)

      E.g. if you do errors.reject("myField", "myErrorCode") you'll actually get an error whose message codes, like "myField.commandObjectName", "myField.commandClass", "myField". The last one of these is supposed to be the default one, to be returned if the code fails. (See http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/context/MessageSourceResolvable.html)

      However when I call MessageSourceService.getMessage(springError, Context.getLocale()), if no localization is found, I get back the first code, rather than the last one.

      The result is that (assuming a validator returned a plain string as an error message, and not a proper error code), the error message I get back from MSS will be like "Identifier [sdafasdfasdfasfd] does not match required format: \d+.request" (note the incorrect .request)

      I think we should do some logic where if the message returned is equal to the first code of the MessageSourceResolvable, we should return the last code rather than the first one.

      This is low-priority, since I'll just work around this in the UI Framework module, but I figured I'd mention it.

      Gliffy Diagrams

        Attachments

          Activity

            People

              shekhar Shekharreddy Mittapelly
              darius Darius Jazayeri
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 1 hour
                  1h
                  Remaining:
                  Remaining Estimate - 1 hour
                  1h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified