Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-7258

Forbid MessageFormat.format and MessageFormat single-arg constructor

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.1, 6.0
    • None
    • None

    Description

      While tracing some TestBlobHandler failures with the thai locale I found that the problem was MessageFormat.format which when given a Number ultimately executes NumberFormat.getInstance(getLocale()).format(argument). In thai locale, this transforms the digit 1 to a thai character and hence fails the test.

      We should audit all usages of MessageFormat.format to see if any Number objects are being passed as argument and wrap them with String.valueOf().

      Edit - Actually most format operations use the default locale so we should just ban this API outright.

      Attachments

        1. SOLR-7258.patch
          30 kB
          Shalin Shekhar Mangar
        2. SOLR-7258.patch
          30 kB
          Shalin Shekhar Mangar

        Issue Links

          Activity

            People

              shalin Shalin Shekhar Mangar
              shalin Shalin Shekhar Mangar
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: