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

[Sonar Findings] [Critical] Array is Stored Directly

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.0 M1
    • Fix Version/s: 4.1.0 RC3
    • Component/s: None
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: