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

Findbug warning for Resource exposing internal representation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 3.0.0
    • None
    • api
    • 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

        1. YARN-7576.001.patch
          2 kB
          Wangda Tan

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jlowe Jason Darrell Lowe
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: