You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2019/08/16 16:43:12 UTC

[myfaces] branch master updated: unified code

This is an automated email from the ASF dual-hosted git repository.

tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/master by this push:
     new 897130d  unified code
897130d is described below

commit 897130dc25ce6b42fd63b639d20201dafaa612e4
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Fri Aug 16 18:43:06 2019 +0200

    unified code
---
 .../apache/myfaces/config/FacesConfigurator.java   | 34 +++-------------------
 1 file changed, 4 insertions(+), 30 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java b/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
index b05fc6b..2b4e8ee 100755
--- a/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
+++ b/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
@@ -819,7 +819,7 @@ public class FacesConfigurator
             //invoke the injection over the inner one first
             if (instance instanceof FacesWrapper)
             {
-                Object innerInstance = ((FacesWrapper)instance).getWrapped();
+                Object innerInstance = ((FacesWrapper) instance).getWrapped();
                 if (innerInstance != null)
                 {
                     _callInjectAndPostConstruct(innerInstance);
@@ -836,7 +836,7 @@ public class FacesConfigurator
         }
         catch (InjectionProviderException ex)
         {
-            log.log(Level.INFO, "Exception on PreDestroy", ex);
+            log.log(Level.INFO, "Exception on Injection or PostConstruct", ex);
         }
     }
 
@@ -871,24 +871,10 @@ public class FacesConfigurator
             runtimeConfig.addResourceBundle(bundle);
         }
 
-        List<BeanEntry> injectedBeansAndMetaData =
-                (List<BeanEntry>)_externalContext.getApplicationMap().get(INJECTED_BEAN_STORAGE_KEY);
-
         for (String className : dispenser.getElResolvers())
         {
             ELResolver elResolver = (ELResolver) ClassUtils.newInstance(className, ELResolver.class);
-            try
-            {
-                Object creationMetaData = getInjectionProvider().inject(elResolver);
-
-                injectedBeansAndMetaData.add(new BeanEntry(elResolver, creationMetaData));
-
-                getInjectionProvider().postConstruct(elResolver, creationMetaData);
-            }
-            catch (InjectionProviderException e)
-            {
-                log.log(Level.SEVERE, "Error while injecting ELResolver", e);
-            }
+            _callInjectAndPostConstruct(elResolver);
             runtimeConfig.addFacesConfigElResolver(elResolver);
         }
         
@@ -1198,9 +1184,6 @@ public class FacesConfigurator
         LifecycleFactory lifecycleFactory
                 = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
 
-        List<BeanEntry> injectedBeanStorage =
-                (List<BeanEntry>)_externalContext.getApplicationMap().get(INJECTED_BEAN_STORAGE_KEY);
-
         for (Iterator<String> it = lifecycleFactory.getLifecycleIds(); it.hasNext();)
         {
             Lifecycle lifecycle = lifecycleFactory.getLifecycle(it.next());
@@ -1212,22 +1195,13 @@ public class FacesConfigurator
                 {
                     PhaseListener listener = (PhaseListener)
                             ClassUtils.newInstance(listenerClassName, PhaseListener.class);
-
-                    Object creationMetaData = getInjectionProvider().inject(listener);
-
-                    injectedBeanStorage.add(new BeanEntry(listener, creationMetaData));
-
-                    getInjectionProvider().postConstruct(listener, creationMetaData);
+                    _callInjectAndPostConstruct(listener);
                     lifecycle.addPhaseListener(listener);
                 }
                 catch (ClassCastException e)
                 {
                     log.severe("Class " + listenerClassName + " does not implement PhaseListener");
                 }
-                catch (InjectionProviderException e)
-                {
-                    log.log(Level.SEVERE, "Error while injecting PhaseListener", e);
-                }
             }
 
             // if ProjectStage is Development, install the DebugPhaseListener