You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/05/12 05:38:05 UTC

svn commit: r943360 - /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java

Author: lu4242
Date: Wed May 12 03:38:04 2010
New Revision: 943360

URL: http://svn.apache.org/viewvc?rev=943360&view=rev
Log:
MYFACES-2711 Application.createComponent(FacesContext,Resource) register listeners twice and call createComponent(String) directly

Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java?rev=943360&r1=943359&r2=943360&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java Wed May 12 03:38:04 2010
@@ -1081,7 +1081,8 @@ public class ApplicationImpl extends App
          * viewId found by calling UIViewRoot.getViewId() on the UIViewRoot in the argument FacesContext.
          */
         UIViewRoot view = context.getViewRoot();
-        ViewDeclarationLanguage vdl = getViewHandler().getViewDeclarationLanguage(context, view.getViewId());
+        Application application = context.getApplication();
+        ViewDeclarationLanguage vdl = application.getViewHandler().getViewDeclarationLanguage(context, view.getViewId());
 
         /*
          * Obtain a reference to the composite component metadata for this composite component by calling
@@ -1100,10 +1101,11 @@ public class ApplicationImpl extends App
          */
         BeanDescriptor descriptor = metadata.getBeanDescriptor();
         ValueExpression componentType = (ValueExpression) descriptor.getValue(UIComponent.COMPOSITE_COMPONENT_TYPE_KEY);
-
+        boolean annotationsApplied = false;
         if (componentType != null)
         {
-            component = createComponent((String) componentType.getValue(context.getELContext()));
+            component = application.createComponent((String) componentType.getValue(context.getELContext()));
+            annotationsApplied = true;
         }
         else
         {
@@ -1174,7 +1176,8 @@ public class ApplicationImpl extends App
                  */
                 if (component == null)
                 {
-                    component = createComponent(UINamingContainer.COMPONENT_TYPE);
+                    component = application.createComponent(UINamingContainer.COMPONENT_TYPE);
+                    annotationsApplied = true;
                 }
             }
         }
@@ -1202,7 +1205,10 @@ public class ApplicationImpl extends App
          * If this annotation is present, the action listed in ListenerFor must be taken on the component, before it is
          * returned from this method.
          */
-        _handleAnnotations(context, component, component);
+        if (!annotationsApplied)
+        {
+            _handleAnnotations(context, component, component);
+        }
 
         return component;
     }