Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-7576

Findbug warning for Resource exposing internal representation

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0
    • Fix Version/s: None
    • Component/s: api
    • Labels:
      None

      Description

      Precommit builds are complaining about a findbugs warning:

      EI 	org.apache.hadoop.yarn.api.records.Resource.getResources() may expose internal representation by returning Resource.resources
      	
      Bug type EI_EXPOSE_REP (click for details)
      In class org.apache.hadoop.yarn.api.records.Resource
      In method org.apache.hadoop.yarn.api.records.Resource.getResources()
      Field org.apache.hadoop.yarn.api.records.Resource.resources
      At Resource.java:[line 213]
      
      Returning a reference to a mutable object value stored in one of the object's fields exposes the internal representation of the object.  If instances are accessed by untrusted code, and unchecked changes to the mutable object would compromise security or other important properties, you will need to do something different. Returning a new copy of the object is better approach in many situations.
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                leftnoteasy Wangda Tan
                Reporter:
                jlowe Jason Lowe
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated: