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 2011/10/26 04:39:00 UTC

svn commit: r1189008 - /myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java

Author: lu4242
Date: Wed Oct 26 02:39:00 2011
New Revision: 1189008

URL: http://svn.apache.org/viewvc?rev=1189008&view=rev
Log:
MYFACES-3372 Multiple Lifecycle instances are not taken into account when setup phase listeners

Modified:
    myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java

Modified: myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java?rev=1189008&r1=1189007&r2=1189008&view=diff
==============================================================================
--- myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java (original)
+++ myfaces/core/branches/1.2.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java Wed Oct 26 02:39:00 2011
@@ -1038,25 +1038,32 @@ public class FacesConfigurator
     private void configureLifecycle()
     {
         // create the lifecycle used by the app
-        LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder
-                .getFactory(FactoryFinder.LIFECYCLE_FACTORY);
-        Lifecycle lifecycle = lifecycleFactory.getLifecycle(getLifecycleId());
-
-        // add phase listeners
-        for (Iterator iterator = getDispenser().getLifecyclePhaseListeners(); iterator.hasNext();)
+        LifecycleFactory lifecycleFactory
+                = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+        
+        //Lifecycle lifecycle = lifecycleFactory.getLifecycle(getLifecycleId());
+        for (Iterator<String> it = lifecycleFactory.getLifecycleIds(); it.hasNext();)
         {
-            String listenerClassName = (String) iterator.next();
-            try
-            {
-                lifecycle.addPhaseListener((PhaseListener) ClassUtils.newInstance(listenerClassName));
-            }
-            catch (ClassCastException e)
+            Lifecycle lifecycle = lifecycleFactory.getLifecycle(it.next());
+            
+            // add phase listeners
+            for (Iterator iterator = getDispenser().getLifecyclePhaseListeners(); iterator.hasNext();)
             {
-                log.error("Class " + listenerClassName + " does not implement PhaseListener");
+                String listenerClassName = (String) iterator.next();
+                try
+                {
+                    lifecycle.addPhaseListener((PhaseListener)
+                            ClassUtils.newInstance(listenerClassName, PhaseListener.class));
+                }
+                catch (ClassCastException e)
+                {
+                    log.error("Class " + listenerClassName + " does not implement PhaseListener");
+                }
             }
         }
     }
 
+    /*
     private String getLifecycleId()
     {
         String id = _externalContext.getInitParameter(FacesServlet.LIFECYCLE_ID_ATTR);
@@ -1067,7 +1074,7 @@ public class FacesConfigurator
         }
 
         return LifecycleFactory.DEFAULT_LIFECYCLE;
-    }
+    }*/
 /*
     public static class VersionInfo
     {