MyFaces Core
  1. MyFaces Core
  2. MYFACES-3248

UIComponentBase.getFacets() should support all Map methods


    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.8, 2.1.2
    • Component/s: JSR-314
    • Labels:


      The javadoc of UIComponent.getFacets() says this:

      "... Return a mutable Map representing the facet UIComponents associated with this UIComponent, keyed by facet name (which must be a String). The returned implementation must support all of the standard and optional Map methods, plus support the following additional requirements:

      • The Map implementation must implement the interface.
      • Any attempt to add a null key or value must throw a NullPointerException.
      • Any attempt to add a key that is not a String must throw a ClassCastException.
      • Any attempt to add a value that is not a UIComponent must throw a ClassCastException.
      • Whenever a new facet UIComponent is added:
      • The parent property of the component must be set to this component instance.
      • If the parent property of the component was already non-null, the component must first be removed from its previous parent (where it may have been either a child or a facet).
      • Whenever an existing facet UIComponent is removed:
      • The parent property of the facet must be set to null.

      The current implementation is not strict about "... the returned implementation must support all of the standard and optional Map methods ...". There are ways to modify facet map indirectly, using iterator.remove(), or entry.setValue() or removing some key, value from entrySet(), keySet() or values() collection.

      These methods are not very common, so in normal use cases there is no problem at all, but at the end this should be done to prevent bug reports like MYFACES-3227, MYFACES-3175 or MYFACES-2407.


        Leonardo Uribe created issue -
        Leonardo Uribe made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0.8 [ 12316514 ]
        Fix Version/s 2.1.2 [ 12316512 ]
        Resolution Fixed [ 1 ]
        Leonardo Uribe made changes -
        Status Resolved [ 5 ] Closed [ 6 ]


          • Assignee:
            Leonardo Uribe
            Leonardo Uribe
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: