Uploaded image for project: 'Stratos'
  1. Stratos
  2. STRATOS-873

[Sonar Findings] [Critical] Array is Stored Directly

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.1.0 M1
    • 4.1.0 RC3
    • None
    • None

    Description

      This is to fix critical Sonar finding "Array is stored directly"

      http://stackoverflow.com/questions/11580948/sonar-violation-security-array-is-stored-directly
      It's complaining that the array you're storing is the same array that is held by the caller. That is, if the caller subsequently modifies this array, the array stored in the object (and hence the object itself) will change.

      The solution is to make a copy within the object when it gets passed. This is called defensive copying. A subsequent modification of the collection won't affect the array stored within the object.

      Attachments

        Activity

          People

            imesh Imesh Gunaratne
            imesh Imesh Gunaratne
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: