Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-15889

String case conversions are locale-sensitive, used without locale

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.2.0
    • 1.4.0, 0.98.20, 2.0.0
    • localization
    • None

    Description

      Static code analysis is flagging cases of String.toLowerCase and String.toUpperCase being used without Locale. From the API reference:

      Note: This method is locale sensitive, and may produce unexpected results if used for strings that are intended to be interpreted locale independently. Examples are programming language identifiers, protocol keys, and HTML tags. For instance, "TITLE".toLowerCase() in a Turkish locale returns "t\u0131tle", where '\u0131' is the LATIN SMALL LETTER DOTLESS I character. To obtain correct results for locale insensitive strings, use toLowerCase(Locale.ROOT).

      Many uses of these functions do appear to be looking up classes, etc. and not dealing with stored data, so I'd think there aren't significant compatibility problems here and specifying the locale is indeed the safer way to go.

      Attachments

        1. HBASE-15889-branch-1.v2.patch
          54 kB
          Sean Mackrory
        2. HBASE-15889-v1.patch
          54 kB
          Sean Mackrory
        3. HBASE-15891-v2.patch
          52 kB
          Sean Mackrory

        Activity

          People

            mackrorysd Sean Mackrory
            mackrorysd Sean Mackrory
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: