myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1072118 - /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/Tomcat7AnnotationLifecycleProvider.java
Date Fri, 18 Feb 2011 19:48:23 GMT
Author: lu4242
Date: Fri Feb 18 19:48:23 2011
New Revision: 1072118

URL: http://svn.apache.org/viewvc?rev=1072118&view=rev
Log:
MYFACES-3035 PostConstruct method is called before properties are injected on Tomcat 7 

Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/Tomcat7AnnotationLifecycleProvider.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/Tomcat7AnnotationLifecycleProvider.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/Tomcat7AnnotationLifecycleProvider.java?rev=1072118&r1=1072117&r2=1072118&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/Tomcat7AnnotationLifecycleProvider.java
(original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/Tomcat7AnnotationLifecycleProvider.java
Fri Feb 18 19:48:23 2011
@@ -18,17 +18,19 @@
  */
 package org.apache.myfaces.config.annotation;
 
-import org.apache.myfaces.shared_impl.util.ClassUtils;
-import org.apache.tomcat.InstanceManager;
-
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.naming.NamingException;
 import java.lang.reflect.InvocationTargetException;
 import java.util.Map;
 import java.util.WeakHashMap;
 import java.util.logging.Logger;
 
+import javax.faces.FacesException;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.naming.NamingException;
+
+import org.apache.myfaces.shared_impl.util.ClassUtils;
+import org.apache.tomcat.InstanceManager;
+
 /**
  * An annotation lifecycle provider for Tomcat 7.
  */
@@ -53,21 +55,6 @@ public class Tomcat7AnnotationLifecycleP
         log.info("Creating instance of " + className);
         Object object = clazz.newInstance();
 
-        InstanceManager manager = instanceManagers
-                .get(ClassUtils.getContextClassLoader());
-        if (manager == null)
-        {
-            //Initialize manager
-            manager = initManager();
-        }
-
-        //Is initialized
-        if (manager != null)
-        {
-            //Inject resources
-            manager.newInstance(object);
-        }
-
         return object;
     }
 
@@ -86,7 +73,27 @@ public class Tomcat7AnnotationLifecycleP
     public void postConstruct(Object instance)
             throws IllegalAccessException, InvocationTargetException
     {
-        //do nothing
+        InstanceManager manager = instanceManagers
+                .get(ClassUtils.getContextClassLoader());
+        if (manager == null)
+        {
+            //Initialize manager
+            manager = initManager();
+        }
+
+        //Is initialized
+        if (manager != null)
+        {
+            //Inject resources
+            try 
+            {
+                manager.newInstance(instance);
+            }
+            catch (NamingException e)
+            {
+                throw new FacesException(e);
+            }
+        }
     }
 
     public boolean isAvailable()



Mime
View raw message