Revised change bundle with @param javadoc
Roger Kitain wrote:
> M 5395 jsf-api/src/javax/faces/component/UIComponent.java
> -- Add FacesContext arg to getCurrentComponent /
> getCurrentCompositeComponent
>
> M 5395
> jsf-ri/src/com/sun/faces/renderkit/html_basic/ConsumingPageCompositeChildrenRenderer.java
>
> M 5395
> jsf-ri/src/com/sun/faces/renderkit/html_basic/CompositeFacetRenderer.java
> M 5395 jsf-ri/src/com/sun/faces/el/ResourceELResolver.java
> -- Add FacesContext arg to getCurrentComponent /
> getCurrentCompositeComponent
>
> Automated tests pass.
>
> -roger
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net
Index: UIComponent.java
===================================================================
--- UIComponent.java (revision 5395)
+++ UIComponent.java (working copy)
@@ -1453,15 +1453,18 @@
* <p class="changed_added_2_0">This method must return
* <code>null</code> if there is no currently processing
* <code>UIComponent</code></p>
- * RELEASE_PENDING (eburns,rogerk) Consider adding FacesContext argument
- * to getCurrentComponent(). There is no need to call this from the EL
- * since we have the 'component' implicit object.
*
+ * @param context {_at_link FacesContext} for the request we are processing
+ *
+ * @throws NullPointerException if <code>context</code>
+ * is <code>null</code>
+ *
* @since 2.0
*/
- public static UIComponent getCurrentComponent() {
-
- FacesContext context = FacesContext.getCurrentInstance();
+ public static UIComponent getCurrentComponent(FacesContext context) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
Map<Object, Object> contextMap = context.getAttributes();
return (UIComponent) contextMap.get(CURRENT_COMPONENT);
@@ -1474,13 +1477,18 @@
* #getCurrentComponent}, that is a composite component, or
* <code>null</code> if no such component exists.</p>
*
+ * @param context {_at_link FacesContext} for the request we are processing
+ *
+ * @throws NullPointerException if <code>context</code>
+ * is <code>null</code>
+ *
* @since 2.0
*/
- public static UIComponent getCurrentCompositeComponent() {
- // RELEASE_PENDING (edburns,rogerk) docs
- // RELEASE_PENDING (eburns,rogerk) Consider adding FacesContext argument
+ public static UIComponent getCurrentCompositeComponent(FacesContext context) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
- FacesContext context = FacesContext.getCurrentInstance();
Map<Object, Object> contextMap = context.getAttributes();
return (UIComponent) contextMap.get(CURRENT_COMPOSITE_COMPONENT);
Index: jsf-ri/src/com/sun/faces/renderkit/html_basic/ConsumingPageCompositeChildrenRenderer.java
===================================================================
--- jsf-ri/src/com/sun/faces/renderkit/html_basic/ConsumingPageCompositeChildrenRenderer.java (revision 5395)
+++ jsf-ri/src/com/sun/faces/renderkit/html_basic/ConsumingPageCompositeChildrenRenderer.java (working copy)
@@ -60,7 +60,7 @@
@Override
public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
- UIComponent currentCompositeComponent = UIComponent.getCurrentCompositeComponent();
+ UIComponent currentCompositeComponent = UIComponent.getCurrentCompositeComponent(context);
if (null != currentCompositeComponent) {
// It must be true that each of the children of the composite
Index: jsf-ri/src/com/sun/faces/renderkit/html_basic/CompositeFacetRenderer.java
===================================================================
--- jsf-ri/src/com/sun/faces/renderkit/html_basic/CompositeFacetRenderer.java (revision 5395)
+++ jsf-ri/src/com/sun/faces/renderkit/html_basic/CompositeFacetRenderer.java (working copy)
@@ -67,7 +67,7 @@
throw new IOException("PENDING_I18N Unable to find facet name to insert facet into composite component");
}
- UIComponent currentCompositeComponent = UIComponent.getCurrentCompositeComponent();
+ UIComponent currentCompositeComponent = UIComponent.getCurrentCompositeComponent(context);
if (null != currentCompositeComponent) {
UIComponent facet = currentCompositeComponent.getFacet(facetName);
if (null != facet) {
Index: jsf-ri/src/com/sun/faces/el/ResourceELResolver.java
===================================================================
--- jsf-ri/src/com/sun/faces/el/ResourceELResolver.java (revision 5395)
+++ jsf-ri/src/com/sun/faces/el/ResourceELResolver.java (working copy)
@@ -46,6 +46,7 @@
import javax.el.PropertyNotFoundException;
import javax.faces.application.Resource;
import javax.faces.application.ResourceHandler;
+import javax.faces.context.FacesContext;
import com.sun.faces.util.MessageUtils;
import com.sun.faces.util.Util;
@@ -113,7 +114,8 @@
// a resource, the "this" syntax for the library name must
// be supported.
if (null != parts[0] && parts[0].equals("this")) {
- UIComponent currentComponent = UIComponent.getCurrentCompositeComponent();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UIComponent currentComponent = UIComponent.getCurrentCompositeComponent(facesContext);
Resource componentResource = (Resource)
currentComponent.getAttributes().get(Resource.COMPONENT_RESOURCE_KEY);
if (null != componentResource) {