Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-506

Entities - missing final modifiers; thread-safety issues

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.5
    • lang.*
    • None

    Description

      Some fields in Entities are used as constants but they are not final, so can be changed accidentally or maliciously:

      ISO8859_1_ARRAY_LENGTH
      HTML40_ARRAY_LENGTH

      Entities.map should also be final
      Entities.LookupEntityMap.LOOKUP_TABLE_SIZE should be final

      Entities.MapIntMap.mapValueToName and mapNameToValue would benefit from being made final.
      This would require a constructor to be added that can initialise the Maps.

      LookupEntityMap is not thread-safe - it creates the lookup table without synchronisation, and mutates it after initial creation.

      Entities.ArrayEntityMap.growBy should be final

      As far as possible, all instance fields to be made final.

      Patch to follow

      Attachments

        1. entities-506-2.patch
          0.6 kB
          Sebb
        2. entities-506-1.patch
          4 kB
          Sebb

        Issue Links

          Activity

            People

              niallp Niall Pemberton
              sebb Sebb
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: