UIComponentBase.getFacets() should support all Map methods
----------------------------------------------------------
Key: MYFACES-3248
URL: https://issues.apache.org/jira/browse/MYFACES-3248
Project: MyFaces Core
Issue Type: Bug
Components: JSR-314
Reporter: Leonardo Uribe
Assignee: Leonardo Uribe
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 java.io.Serializable 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.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira